File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
src/Symfony/Component/Finder Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -669,7 +669,8 @@ public function append($iterator)
669
669
} elseif ($ iterator instanceof \Traversable || \is_array ($ iterator )) {
670
670
$ it = new \ArrayIterator ();
671
671
foreach ($ iterator as $ file ) {
672
- $ it ->append ($ file instanceof \SplFileInfo ? $ file : new \SplFileInfo ($ file ));
672
+ $ file = $ file instanceof \SplFileInfo ? $ file : new \SplFileInfo ($ file );
673
+ $ it [$ file ->getRealPath ()] = $ file ;
673
674
}
674
675
$ this ->iterators [] = $ it ;
675
676
} else {
Original file line number Diff line number Diff line change @@ -1119,6 +1119,17 @@ public function testAppendDoesNotRequireIn()
1119
1119
$ this ->assertIterator (iterator_to_array ($ finder ->getIterator ()), $ finder1 ->getIterator ());
1120
1120
}
1121
1121
1122
+ public function testMultipleAppendCallsWithSorting ()
1123
+ {
1124
+ $ finder = $ this ->buildFinder ()
1125
+ ->sortByName ()
1126
+ ->append ([self ::$ tmpDir .\DIRECTORY_SEPARATOR .'qux_1000_1.php ' ])
1127
+ ->append ([self ::$ tmpDir .\DIRECTORY_SEPARATOR .'qux_1002_0.php ' ])
1128
+ ;
1129
+
1130
+ $ this ->assertOrderedIterator ($ this ->toAbsolute (['qux_1000_1.php ' , 'qux_1002_0.php ' ]), $ finder ->getIterator ());
1131
+ }
1132
+
1122
1133
public function testCountDirectories ()
1123
1134
{
1124
1135
$ directory = Finder::create ()->directories ()->in (self ::$ tmpDir );
You can’t perform that action at this time.
0 commit comments