@@ -48,15 +48,40 @@ public function testFiles()
48
48
49
49
public function testRemoveTrailingSlash ()
50
50
{
51
- if ('\\' === \DIRECTORY_SEPARATOR ) {
52
- $ this ->markTestSkipped ('This test cannot be run on Windows. ' );
51
+ $ finder = $ this ->buildFinder ();
52
+
53
+ $ expected = $ this ->toAbsolute (array ('foo/bar.tmp ' , 'test.php ' , 'test.py ' , 'foo bar ' ));
54
+ $ in = self ::$ tmpDir .'// ' ;
55
+
56
+ $ this ->assertIterator ($ expected , $ finder ->in ($ in )->files ()->getIterator ());
57
+ }
58
+
59
+ public function testSymlinksNotResolved ()
60
+ {
61
+ if ('\\' === DIRECTORY_SEPARATOR ) {
62
+ $ this ->markTestSkipped ('symlinks are not supported on Windows ' );
53
63
}
54
64
55
65
$ finder = $ this ->buildFinder ();
56
66
57
- $ expected = $ this ->toAbsolute (array ('foo/bar.tmp ' , 'test.php ' , 'test.py ' , 'foo bar ' ));
58
- $ in = '// ' .realpath (self ::$ tmpDir ).'// ' ;
67
+ symlink ($ this ->toAbsolute ('foo ' ), $ this ->toAbsolute ('baz ' ));
68
+ $ expected = $ this ->toAbsolute (array ('baz/bar.tmp ' ));
69
+ $ in = self ::$ tmpDir .'/baz/ ' ;
70
+ try {
71
+ $ this ->assertIterator ($ expected , $ finder ->in ($ in )->files ()->getIterator ());
72
+ unlink ($ this ->toAbsolute ('baz ' ));
73
+ } catch (\Exception $ e ) {
74
+ unlink ($ this ->toAbsolute ('baz ' ));
75
+ throw $ e ;
76
+ }
77
+ }
78
+
79
+ public function testBackPathNotNormalized ()
80
+ {
81
+ $ finder = $ this ->buildFinder ();
59
82
83
+ $ expected = $ this ->toAbsolute (array ('foo/../foo/bar.tmp ' ));
84
+ $ in = self ::$ tmpDir .'/foo/../foo/ ' ;
60
85
$ this ->assertIterator ($ expected , $ finder ->in ($ in )->files ()->getIterator ());
61
86
}
62
87
@@ -275,7 +300,7 @@ public function testInWithNonExistentDirectory()
275
300
public function testInWithGlob ()
276
301
{
277
302
$ finder = $ this ->buildFinder ();
278
- $ finder ->in (array (__DIR__ .'/Fixtures/*/B/C ' , __DIR__ .'/Fixtures/*/*/B/C ' ))->getIterator ();
303
+ $ finder ->in (array (__DIR__ .'/Fixtures/*/B/C/ ' , __DIR__ .'/Fixtures/*/*/B/C/ ' ))->getIterator ();
279
304
280
305
$ this ->assertIterator ($ this ->toAbsoluteFixtures (array ('A/B/C/abc.dat ' , 'copy/A/B/C/abc.dat.copy ' )), $ finder );
281
306
}
@@ -528,8 +553,8 @@ public function testMultipleLocationsWithSubDirectories()
528
553
$ finder ->in ($ locations )->depth ('< 10 ' )->name ('*.neon ' );
529
554
530
555
$ expected = array (
531
- __DIR__ .DIRECTORY_SEPARATOR . ' Fixtures ' . DIRECTORY_SEPARATOR . ' one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'c.neon ' ,
532
- __DIR__ .DIRECTORY_SEPARATOR . ' Fixtures ' . DIRECTORY_SEPARATOR . ' one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'d.neon ' ,
556
+ __DIR__ .' / Fixtures/ one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'c.neon ' ,
557
+ __DIR__ .' / Fixtures/ one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'d.neon ' ,
533
558
);
534
559
535
560
$ this ->assertIterator ($ expected , $ finder );
0 commit comments