diff options
author | Vitor Mattos <vitor@php.rio> | 2021-09-15 17:48:43 +0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2021-09-15 18:35:32 +0300 |
commit | b0031e3eaaa949357c4a80f673fc72dc131f04f0 (patch) | |
tree | 23c7722a579c9683ef1c8ea1c885ad6c437c215f /tests | |
parent | 5b2499fbf06f8aca982f51b448d620db0b35dc52 (diff) |
Fixes to remove warnings when use phpunit 9.5.6
Replace method at by withConsecutive and use a condition to prevent
error when not has expected message. Removed the expects because the test
already validates the input parameters and the expected result
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/php/Chat/SystemMessage/ListenerTest.php | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/php/Chat/SystemMessage/ListenerTest.php b/tests/php/Chat/SystemMessage/ListenerTest.php index 79bb4109e..60b8d946a 100644 --- a/tests/php/Chat/SystemMessage/ListenerTest.php +++ b/tests/php/Chat/SystemMessage/ListenerTest.php @@ -217,18 +217,21 @@ class ListenerTest extends TestCase { // TODO: add all cases $event = new AddParticipantsEvent($room, $participants); - foreach ($expectedMessages as $index => $expectedMessage) { - $this->chatManager->expects($this->at($index)) + foreach ($expectedMessages as $expectedMessage) { + $consecutive[] = [ + $room, + $expectedMessage['actorType'], + $expectedMessage['actorId'], + json_encode($expectedMessage['message']), + $this->dummyTime, + false, + self::DUMMY_REFERENCE_ID, + ]; + } + if (isset($consecutive)) { + $this->chatManager ->method('addSystemMessage') - ->with( - $room, - $expectedMessage['actorType'], - $expectedMessage['actorId'], - json_encode($expectedMessage['message']), - $this->dummyTime, - false, - self::DUMMY_REFERENCE_ID, - ); + ->withConsecutive(...$consecutive); } $this->dispatch(Room::EVENT_AFTER_USERS_ADD, $event); |