@@ -50,15 +50,40 @@ public function testFiles()
50
50
51
51
public function testRemoveTrailingSlash ()
52
52
{
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 ' );
55
65
}
56
66
57
67
$ finder = $ this ->buildFinder ();
58
68
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 ();
61
84
85
+ $ expected = $ this ->toAbsolute (array ('foo/../foo/bar.tmp ' ));
86
+ $ in = self ::$ tmpDir .'/foo/../foo/ ' ;
62
87
$ this ->assertIterator ($ expected , $ finder ->in ($ in )->files ()->getIterator ());
63
88
}
64
89
@@ -280,7 +305,7 @@ public function testInWithNonExistentDirectory()
280
305
public function testInWithGlob ()
281
306
{
282
307
$ 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 ();
284
309
285
310
$ this ->assertIterator ($ this ->toAbsoluteFixtures (array ('A/B/C/abc.dat ' , 'copy/A/B/C/abc.dat.copy ' )), $ finder );
286
311
}
@@ -519,8 +544,8 @@ public function testMultipleLocationsWithSubDirectories()
519
544
$ finder ->in ($ locations )->depth ('< 10 ' )->name ('*.neon ' );
520
545
521
546
$ 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 ' ,
524
549
);
525
550
526
551
$ this ->assertIterator ($ expected , $ finder );
0 commit comments