Skip to content

Commit 8b2a917

Browse files
committed
Test JSON strings by decoding as order is undefined
1 parent 5e3d016 commit 8b2a917

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tests/Base.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,16 @@ public function testHTTPSuccess(): void
204204

205205
echo \implode("\n", $output);
206206

207-
$this->assertEquals([], \array_diff($this->expectedOutput, $output));
207+
foreach ($this->expectedOutput as $index => $expected) {
208+
if (\str_starts_with($expected, '{')) {
209+
$this->assertEquals(
210+
\json_decode($expected, true),
211+
\json_decode($output[$index], true)
212+
);
213+
} else {
214+
$this->assertEquals($expected, $output[$index]);
215+
}
216+
}
208217
}
209218

210219
private function rmdirRecursive($dir): void

tests/Swift56Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Swift56Test extends Base
1616
'cp tests/languages/swift/Tests.swift tests/sdks/swift/Tests/AppwriteTests/Tests.swift',
1717
];
1818
protected string $command =
19-
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/swift swift:5.6 swift test';
19+
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/swift swift:5.6-focal swift test';
2020

2121
protected array $expectedOutput = [
2222
...Base::FOO_RESPONSES,

0 commit comments

Comments
 (0)