8000 minor #39704 [Finder] actually compare the order of entries when any … · symfony/symfony@135a9b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 135a9b2

Browse files
committed
minor #39704 [Finder] actually compare the order of entries when any sorting is applied (xabbuh)
This PR was merged into the 4.4 branch. Discussion ---------- [Finder] actually compare the order of entries when any sorting is applied | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Without this change the tests where still passing if the sorting didn't work as expected. There are three more tests that sort by file times. I do not really know how to make them more stable though. Commits ------- f1ed653 actually compare the order of entries when any sorting is applied
2 parents b9bdb8e + f1ed653 commit 135a9b2

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/Symfony/Component/Finder/Tests/FinderTest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ public function testSortByName()
631631
{
632632
$finder = $this->buildFinder();
633633
$this->assertSame($finder, $finder->sortByName());
634-
$this->assertIterator($this->toAbsolute([
634+
$this->assertOrderedIterator($this->toAbsolute([
635635
'foo',
636636
'foo bar',
637637
'foo/bar.tmp',
@@ -654,14 +654,12 @@ public function testSortByType()
654654
{
655655
$finder = $this->buildFinder();
656656
$this->assertSame($finder, $finder->sortByType());
657-
$this->assertIterator($this->toAbsolute([
657+
$this->assertOrderedIterator($this->toAbsolute([
658658
'foo',
659-
'foo bar',
659+
'qux',
660660
'toto',
661+
'foo bar',
661662
'foo/bar.tmp',
662-
'test.php',
663-
'test.py',
664-
'qux',
665663
'qux/baz_100_1.py',
666664
'qux/baz_1_2.py',
667665
'qux_0_1.php',
@@ -670,6 +668,8 @@ public function testSortByType()
670668
'qux_10_2.php',
671669
'qux_12_0.php',
672670
'qux_2_0.php',
671+
'test.php',
672+
'test.py',
673673
]), $finder->in(self::$tmpDir)->getIterator());
674674
}
675675

@@ -770,27 +770,27 @@ public function testSortByNameNatural()
770770
{
771771
$finder = $this->buildFinder();
772772
$this->assertSame($finder, $finder->sortByName(true));
773-
$this->assertIterator($this->toAbsolute([
773+
$this->assertOrderedIterator($this->toAbsolute([
774774
'foo',
775-
'foo bar',
776775
'foo/bar.tmp',
776+
'foo bar',
777777
'qux',
778-
'qux/baz_100_1.py',
779778
'qux/baz_1_2.py',
779+
'qux/baz_100_1.py',
780780
'qux_0_1.php',
781-
'qux_1000_1.php',
782-
'qux_1002_0.php',
781+
'qux_2_0.php',
783782
'qux_10_2.php',
784783
'qux_12_0.php',
785-
'qux_2_0.php',
784+
'qux_1000_1.php',
785+
'qux_1002_0.php',
786786
'test.php',
787787
'test.py',
788788
'toto',
789789
]), $finder->in(self::$tmpDir)->getIterator());
790790

791791
$finder = $this->buildFinder();
792792
$this->assertSame($finder, $finder->sortByName(false));
793-
$this->assertIterator($this->toAbsolute([
793+
$this->assertOrderedIterator($this->toAbsolute([
794794
'foo',
795795
'foo bar',
796796
'foo/bar.tmp',
@@ -813,13 +813,10 @@ public function testSort()
813813
{
814814
$finder = $this->buildFinder();
815815
$this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }));
816-
$this->assertIterator($this->toAbsolute([
816+
$this->assertOrderedIterator($this->toAbsolute([
817817
'foo',
818818
'foo bar',
819819
'foo/bar.tmp',
820-
'test.php',
821-
'test.py',
822-
'toto',
823820
'qux',
824821
'qux/baz_100_1.py',
825822
'qux/baz_1_2.py',
@@ -829,6 +826,9 @@ public function testSort()
829826
'qux_10_2.php',
830827
'qux_12_0.php',
831828
'qux_2_0.php',
829+
'test.php',
830+
'test.py',
831+
'toto',
832832
]), $finder->in(self::$tmpDir)->getIterator());
833833
}
834834

0 commit comments

Comments
 (0)
0