1 | <?php |
||
6 | |||
7 | class FileHandlerTest extends \PHPUnit_Framework_TestCase |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * @var FileHandler |
||
12 | */ |
||
13 | private $fileHandler; |
||
14 | |||
15 | protected function setUp() |
||
21 | |||
22 | /** |
||
23 | * @dataProvider preparePathProvider |
||
24 | * @param $path |
||
25 | * @param $expected |
||
26 | */ |
||
27 | public function testPreparePath($path, $expected) |
||
31 | |||
32 | public function preparePathProvider() |
||
49 | |||
50 | /** |
||
51 | * @param $name |
||
52 | * @param $expected |
||
53 | * |
||
54 | * @dataProvider argumentValueProvider |
||
55 | */ |
||
56 | public function testArgumentValue($name, $expected) |
||
60 | |||
61 | public function argumentValueProvider() |
||
74 | |||
75 | |||
76 | /** |
||
77 | * @param $currentPath |
||
78 | * @param $importPath |
||
79 | * @param $expected |
||
80 | * @dataProvider resolvePathProvider |
||
81 | */ |
||
82 | public function testResolvePath($currentPath, $importPath, $expected) |
||
86 | |||
87 | public function resolvePathProvider() |
||
113 | |||
114 | public function testInitDirectory() |
||
115 | { |
||
116 | $dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'testInitDirectory'; |
||
117 | |||
118 | if (is_dir($dir)) { |
||
119 | rmdir($dir); |
||
120 | } |
||
121 | |||
122 | //currently doesn't exists |
||
123 | $this->assertFalse(is_dir($dir)); |
||
124 | |||
125 | //create one |
||
126 | $this->fileHandler->initDirectory($dir); |
||
127 | $this->assertTrue(is_dir($dir)); |
||
128 | |||
129 | //if is existing |
||
130 | $this->fileHandler->initDirectory($dir); |
||
131 | $this->assertTrue(is_dir($dir)); |
||
132 | |||
136 |