@@ -48,15 +48,40 @@ public function testFiles()
4848
4949 public function testRemoveTrailingSlash ()
5050 {
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 ' );
5363 }
5464
5565 $ finder = $ this ->buildFinder ();
5666
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 ();
5982
83+ $ expected = $ this ->toAbsolute (array ('foo/../foo/bar.tmp ' ));
84+ $ in = self ::$ tmpDir .'/foo/../foo/ ' ;
6085 $ this ->assertIterator ($ expected , $ finder ->in ($ in )->files ()->getIterator ());
6186 }
6287
@@ -275,7 +300,7 @@ public function testInWithNonExistentDirectory()
275300 public function testInWithGlob ()
276301 {
277302 $ 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 ();
279304
280305 $ this ->assertIterator ($ this ->toAbsoluteFixtures (array ('A/B/C/abc.dat ' , 'copy/A/B/C/abc.dat.copy ' )), $ finder );
281306 }
@@ -528,8 +553,8 @@ public function testMultipleLocationsWithSubDirectories()
528553 $ finder ->in ($ locations )->depth ('< 10 ' )->name ('*.neon ' );
529554
530555 $ 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 ' ,
533558 );
534559
535560 $ this ->assertIterator ($ expected , $ finder );
0 commit comments