File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed 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)
669669 } elseif ($ iterator instanceof \Traversable || \is_array ($ iterator )) {
670670 $ it = new \ArrayIterator ();
671671 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 ->getPathname ()] = $ file ;
673674 }
674675 $ this ->iterators [] = $ it ;
675676 } else {
Original file line number Diff line number Diff line change @@ -1119,6 +1119,17 @@ public function testAppendDoesNotRequireIn()
11191119 $ this ->assertIterator (iterator_to_array ($ finder ->getIterator ()), $ finder1 ->getIterator ());
11201120 }
11211121
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+
11221133 public function testCountDirectories ()
11231134 {
11241135 $ directory = Finder::create ()->directories ()->in (self ::$ tmpDir );
You can’t perform that action at this time.
0 commit comments