@@ -50,15 +50,40 @@ public function testFiles()
5050
5151 public function testRemoveTrailingSlash ()
5252 {
53- if ('\\' === \DIRECTORY_SEPARATOR ) {
54- $ this ->markTestSkipped ('This test cannot be run on Windows. ' );
53+ $ finder = $ this ->buildFinder ();
54+
55+ $ expected = $ this ->toAbsolute (array ('foo/bar.tmp ' , 'test.php ' , 'test.py ' , 'foo bar ' ));
56+ $ in = self ::$ tmpDir .'// ' ;
57+
58+ $ this ->assertIterator ($ expected , $ finder ->in ($ in )->files ()->getIterator ());
59+ }
60+
61+ public function testSymlinksNotResolved ()
62+ {
63+ if ('\\' === DIRECTORY_SEPARATOR ) {
64+ $ this ->markTestSkipped ('symlinks are not supported on Windows ' );
5565 }
5666
5767 $ finder = $ this ->buildFinder ();
5868
59- $ expected = $ this ->toAbsolute (array ('foo/bar.tmp ' , 'test.php ' , 'test.py ' , 'foo bar ' ));
60- $ in = '// ' .realpath (self ::$ tmpDir ).'// ' ;
69+ symlink ($ this ->toAbsolute ('foo ' ), $ this ->toAbsolute ('baz ' ));
70+ $ expected = $ this ->toAbsolute (array ('baz/bar.tmp ' ));
71+ $ in = self ::$ tmpDir .'/baz/ ' ;
72+ try {
73+ $ this ->assertIterator ($ expected , $ finder ->in ($ in )->files ()->getIterator ());
74+ unlink ($ this ->toAbsolute ('baz ' ));
75+ } catch (\Exception $ e ) {
76+ unlink ($ this ->toAbsolute ('baz ' ));
77+ throw $ e ;
78+ }
79+ }
80+
81+ public function testBackPathNotNormalized ()
82+ {
83+ $ finder = $ this ->buildFinder ();
6184
85+ $ expected = $ this ->toAbsolute (array ('foo/../foo/bar.tmp ' ));
86+ $ in = self ::$ tmpDir .'/foo/../foo/ ' ;
6287 $ this ->assertIterator ($ expected , $ finder ->in ($ in )->files ()->getIterator ());
6388 }
6489
@@ -279,7 +304,7 @@ public function testInWithNonExistentDirectory()
279304 public function testInWithGlob ()
280305 {
281306 $ finder = $ this ->buildFinder ();
282- $ finder ->in (array (__DIR__ .'/Fixtures/*/B/C ' , __DIR__ .'/Fixtures/*/*/B/C ' ))->getIterator ();
307+ $ finder ->in (array (__DIR__ .'/Fixtures/*/B/C/ ' , __DIR__ .'/Fixtures/*/*/B/C/ ' ))->getIterator ();
283308
284309 $ this ->assertIterator ($ this ->toAbsoluteFixtures (array ('A/B/C/abc.dat ' , 'copy/A/B/C/abc.dat.copy ' )), $ finder );
285310 }
@@ -518,8 +543,8 @@ public function testMultipleLocationsWithSubDirectories()
518543 $ finder ->in ($ locations )->depth ('< 10 ' )->name ('*.neon ' );
519544
520545 $ expected = array (
521- __DIR__ .DIRECTORY_SEPARATOR . ' Fixtures ' . DIRECTORY_SEPARATOR . ' one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'c.neon ' ,
522- __DIR__ .DIRECTORY_SEPARATOR . ' Fixtures ' . DIRECTORY_SEPARATOR . ' one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'d.neon ' ,
546+ __DIR__ .' / Fixtures/ one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'c.neon ' ,
547+ __DIR__ .' / Fixtures/ one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'d.neon ' ,
523548 );
524549
525550 $ this ->assertIterator ($ expected , $ finder );
0 commit comments