@@ -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
@@ -280,7 +305,7 @@ public function testInWithNonExistentDirectory()
280305 public function testInWithGlob ()
281306 {
282307 $ finder = $ this ->buildFinder ();
283- $ finder ->in (array (__DIR__ .'/Fixtures/*/B/C ' , __DIR__ .'/Fixtures/*/*/B/C ' ))->getIterator ();
308+ $ finder ->in (array (__DIR__ .'/Fixtures/*/B/C/ ' , __DIR__ .'/Fixtures/*/*/B/C/ ' ))->getIterator ();
284309
285310 $ this ->assertIterator ($ this ->toAbsoluteFixtures (array ('A/B/C/abc.dat ' , 'copy/A/B/C/abc.dat.copy ' )), $ finder );
286311 }
@@ -519,8 +544,8 @@ public function testMultipleLocationsWithSubDirectories()
519544 $ finder ->in ($ locations )->depth ('< 10 ' )->name ('*.neon ' );
520545
521546 $ expected = array (
522- __DIR__ .DIRECTORY_SEPARATOR . ' Fixtures ' . DIRECTORY_SEPARATOR . ' one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'c.neon ' ,
523- __DIR__ .DIRECTORY_SEPARATOR . ' Fixtures ' . DIRECTORY_SEPARATOR . ' one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'d.neon ' ,
547+ __DIR__ .' / Fixtures/ one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'c.neon ' ,
548+ __DIR__ .' / Fixtures/ one ' .DIRECTORY_SEPARATOR .'b ' .DIRECTORY_SEPARATOR .'d.neon ' ,
524549 );
525550
526551 $ this ->assertIterator ($ expected , $ finder );
0 commit comments