Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-02-11 18:16:40 +0300
committerVitor Mattos <vitor@php.rio>2022-02-15 18:49:54 +0300
commitc028352454c6aee79b7a9c8d066a8cf00615b1be (patch)
tree2a4cfabcbe7f6ca8211d6502c2c9d672634bf0ed /tests
parent0a62079b1754e587138b5732a5e92838859fcde0 (diff)
Change return format
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php36
1 files changed, 22 insertions, 14 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 169adc3ac..3bdca6641 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -447,8 +447,8 @@ class FeatureContext implements Context, SnippetAcceptingContext {
return $attendee;
}, $result);
- usort($expected, [$this, 'sortAttendees']);
- usort($result, [$this, 'sortAttendees']);
+ usort($expected, [self::class, 'sortAttendees']);
+ usort($result, [self::class, 'sortAttendees']);
Assert::assertEquals($expected, $result);
} else {
@@ -477,7 +477,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
}
- protected function sortAttendees(array $a1, array $a2): int {
+ protected static function sortAttendees(array $a1, array $a2): int {
if (array_key_exists('participantType', $a1) && array_key_exists('participantType', $a2) && $a1['participantType'] !== $a2['participantType']) {
return $a1['participantType'] <=> $a2['participantType'];
}
@@ -2111,19 +2111,27 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
private function assertReactionList(TableNode $formData): void {
- $expected = $formData->getHash();
+ $expected = [];
+ foreach ($formData->getHash() as $row) {
+ $reaction = $row['reaction'];
+ unset($row['reaction']);
+ $expected[$reaction][] = $row;
+ }
$result = $this->getDataFromResponse($this->response);
- $result = array_map(function ($reaction) {
- unset($reaction['timestamp']);
- return $reaction;
- }, $result);
-
- Assert::assertCount(count($formData->getHash()), $result, 'Reaction count does not match');
-
- usort($expected, [$this, 'sortAttendees']);
- usort($result, [$this, 'sortAttendees']);
- Assert::assertEquals($expected, $result);
+ $result = array_map(static function ($reaction, $list) use ($expected): array {
+ $list = array_map(function ($reaction) {
+ unset($reaction['timestamp']);
+ return $reaction;
+ }, $list);
+ Assert::assertCount(count($list), $expected[$reaction], 'Reaction count by type does not match');
+
+ usort($expected[$reaction], [self::class, 'sortAttendees']);
+ usort($list, [self::class, 'sortAttendees']);
+ Assert::assertEquals($expected[$reaction], $list, 'Reaction list by type does not match');
+ return $list;
+ }, array_keys($result), array_values($result));
+ Assert::assertCount(count($expected), $result, 'Reaction count does not match');
}
/*