Total Complexity | 4 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | final class PathHelperTest extends TestCase |
||
11 | { |
||
12 | /** |
||
13 | * @dataProvider notExistsFilesProvider() |
||
14 | * @param string $pathToCheck |
||
15 | * @param string $expected |
||
16 | */ |
||
17 | public function testRealpath(string $pathToCheck, string $expected): void |
||
18 | { |
||
19 | $this->assertEquals($expected, PathHelper::realpath($pathToCheck)); |
||
20 | } |
||
21 | |||
22 | public function notExistsFilesProvider(): array |
||
23 | { |
||
24 | return [ |
||
25 | [ |
||
26 | '/tmp/yii_temp_file', |
||
27 | '/tmp/yii_temp_file', |
||
28 | ], |
||
29 | [ |
||
30 | '/tmp/yii/temp/../../file', |
||
31 | '/tmp/file', |
||
32 | ], |
||
33 | [ |
||
34 | 'C:\Temp\Yii\File', |
||
35 | 'C:/Temp/Yii/File', |
||
36 | ], |
||
37 | [ |
||
38 | 'C:\Temp\Yii\..\..\File', |
||
39 | 'C:/File', |
||
40 | ], |
||
41 | [ |
||
42 | 'C:\Temp\Yii\../../Temp/Yii/File', |
||
43 | 'C:/Temp/Yii/File', |
||
44 | ], |
||
45 | ]; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @dataProvider nonNormalizedPathsProvider() |
||
50 | * @param string $pathToCheck |
||
51 | * @param string $expected |
||
52 | */ |
||
53 | public function testNormalize(string $pathToCheck, string $expected): void |
||
54 | { |
||
55 | $this->assertEquals($expected, PathHelper::normalize($pathToCheck)); |
||
56 | } |
||
57 | |||
58 | public function nonNormalizedPathsProvider(): array |
||
76 | ], |
||
77 | ]; |
||
78 | } |
||
79 | } |
||
80 |