summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-01-05 09:59:08 +0100
committerJoas Schilling <coding@schilljs.com>2023-01-19 08:26:26 +0100
commitd081664117fe43b9c4b2a55122f74d2e3a9778cc (patch)
treed6121198aa16102fd113604946b57ce76c265166 /tests
parent075e70b04981626482ce6136726b86ac611ad5a8 (diff)
fix(CI): Make the sorting work without knowing IDs
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 56c6e6265..7569611d7 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -328,19 +328,26 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$expected = $formData->getHash();
if ($shouldOrder) {
$sorter = static function (array $roomA, array $roomB): int {
- $idA = $roomA['id'];
- $idB = $roomB['id'];
+ $idA = $roomA['id'] ?? self::$identifierToId[$roomA['name']];
+ $idB = $roomB['id'] ?? self::$identifierToId[$roomB['name']];
+
if (isset(self::$identifierToId[$idA])) {
$idA = self::$identifierToId[$idA];
+ } else {
+ self::$identifierToId[$roomA['name']] = $idA;
}
+
if (isset(self::$identifierToId[$idB])) {
$idB = self::$identifierToId[$idB];
+ } else {
+ self::$identifierToId[$roomB['name']] = $idB;
}
+
return $idA < $idB ? -1 : 1;
};
- usort($expected, $sorter);
usort($rooms, $sorter);
+ usort($expected, $sorter);
}
Assert::assertEquals($expected, array_map(function ($room, $expectedRoom) {