From 5d3fda69bab4c2724a2bbc1778cdf2916edf675c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <5175937+theofidry@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:32:11 +0200 Subject: [PATCH] test: Fix e2e AutoReview test (#1070) It looks like in some versions of PHPUnit the assert equal canonicalizing is not really taking care of the keys. I can't find the changelog about it though. --- tests/AutoReview/GAE2ETest.php | 3 +++ tests/AutoReview/MakefileE2ETest.php | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/AutoReview/GAE2ETest.php b/tests/AutoReview/GAE2ETest.php index a574103a..e10a2bae 100644 --- a/tests/AutoReview/GAE2ETest.php +++ b/tests/AutoReview/GAE2ETest.php @@ -17,6 +17,7 @@ use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\TestCase; use function array_diff; +use function sort; /** * @internal @@ -32,6 +33,8 @@ class GAE2ETest extends TestCase public function test_github_actions_executes_all_the_e2e_tests(): void { $expected = array_diff(E2ECollector::getE2ENames(), self::IGNORED_E2E_TESTS); + sort($expected); + $actual = GAE2ECollector::getExecutedE2ETests(); self::assertEqualsCanonicalizing($expected, $actual); diff --git a/tests/AutoReview/MakefileE2ETest.php b/tests/AutoReview/MakefileE2ETest.php index 0b48fe0d..7fad104f 100644 --- a/tests/AutoReview/MakefileE2ETest.php +++ b/tests/AutoReview/MakefileE2ETest.php @@ -23,6 +23,7 @@ use function array_values; use function current; use function Safe\file_get_contents; +use function sort; use function str_starts_with; /** @@ -93,7 +94,10 @@ private static function retrieveE2ERule(): array $e2eRule = current($e2eRules); self::assertNotFalse($e2eRule, 'Expected to find the e2e rule in the Makefile.'); - return $e2eRule->getPrerequisites(); + $finalE2eRules = $e2eRule->getPrerequisites(); + sort($finalE2eRules); + + return $finalE2eRules; } /**