Skip to content

Commit

Permalink
Revert "Fix for issue #112 - ArrayComparator in canonicalize mode"
Browse files Browse the repository at this point in the history
This reverts commit b021fdb.
  • Loading branch information
sebastianbergmann committed Oct 18, 2024
1 parent cb66e1b commit dd41bfe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 50 deletions.
10 changes: 2 additions & 8 deletions src/ArrayComparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
namespace SebastianBergmann\Comparator;

use function array_is_list;
use function array_key_exists;
use function assert;
use function is_array;
Expand Down Expand Up @@ -40,13 +39,8 @@ public function assertEquals(mixed $expected, mixed $actual, float $delta = 0.0,
assert(is_array($actual));

if ($canonicalize) {
if (array_is_list($expected)) {
sort($expected);
}

if (array_is_list($actual)) {
sort($actual);
}
sort($expected);
sort($actual);
}

$remaining = $actual;
Expand Down
42 changes: 0 additions & 42 deletions tests/ArrayComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,30 +67,6 @@ public static function assertEqualsSucceedsProvider(): array
['true'],
[true],
],
[
[1, [1, 2, 3]],
[[3, 1, 2], 1],
0,
true,
],
[
[1, [4, 7], [1, 2, 3], [0, 0, 0, 0]],
[[3, 1, 2], [0, 0, 0, 0], [4, 7], 1],
0,
true,
],
[
[1, [4, [4, 5, 6, 7, 8]], [1, 2, 3]],
[[3, 1, 2], [[4, 8, 6, 7, 5], 4], 1],
0,
true,
],
[
[null, null, 1, 1],
[1, null, 1, null],
0,
true,
],
];
}

Expand Down Expand Up @@ -136,24 +112,6 @@ public static function assertEqualsFailsProvider(): array
['false'],
[false],
],
[
['a' => '1', 'b' => '2'],
['c' => '1', 'd' => '2'],
0,
true,
],
[
['a' => '1', 'b' => '2'],
['a' => '2', 'b' => '1'],
0,
true,
],
[
['a' => '1', 'b' => '2'],
['a' => '1', 'b' => '2', 'c' => '2'],
0,
true,
],
];
}

Expand Down

0 comments on commit dd41bfe

Please sign in to comment.