-
Notifications
You must be signed in to change notification settings - Fork 0
/
FinderTest.php
executable file
·68 lines (52 loc) · 1.54 KB
/
FinderTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
namespace Eliurkis\laravelcdn\Tests;
use Illuminate\Support\Collection;
use Mockery as M;
/**
* Class FinderTest.
*
* @category Test
*
* @author Mahmoud Zalt <mahmoud@vinelab.com>
*/
class FinderTest extends TestCase
{
public function setUp()
{
parent::setUp();
}
public function tearDown()
{
M::close();
parent::tearDown();
}
public function testReadReturnCorrectDataType()
{
$asset_holder = new \Eliurkis\laravelcdn\Asset();
$asset_holder->init([
'include' => [
'directories' => [__DIR__],
],
]);
$console_output = M::mock('Symfony\Component\Console\Output\ConsoleOutput');
$console_output->shouldReceive('writeln')
->atLeast(1);
$finder = new \Eliurkis\laravelcdn\Finder($console_output);
$result = $finder->read($asset_holder);
assertInstanceOf('Symfony\Component\Finder\SplFileInfo', $result->first());
assertEquals($result, new Collection($result->all()));
}
/**
* @expectedException \InvalidArgumentException
*/
public function testReadThrowsException()
{
$asset_holder = new \Eliurkis\laravelcdn\Asset();
$asset_holder->init(['include' => []]);
$console_output = M::mock('Symfony\Component\Console\Output\ConsoleOutput');
$console_output->shouldReceive('writeln')
->atLeast(1);
$finder = new \Eliurkis\laravelcdn\Finder($console_output);
$finder->read($asset_holder);
}
}