diff options
author | Vitor Mattos <vitor@php.rio> | 2022-02-08 17:28:16 +0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-02-15 18:49:54 +0300 |
commit | 61f3e53fe5c54fc47b9f805049dce94cfa3d24c4 (patch) | |
tree | f5951fba583983669209b8a8f9f9ad59a7855d14 /tests | |
parent | e907617e93cac5a56c5ac9ac78a0de136912319b (diff) |
Make possible define attributes of room attendees
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/php/Chat/NotifierTest.php | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/tests/php/Chat/NotifierTest.php b/tests/php/Chat/NotifierTest.php index 8bcff7e6d..2d09b9cb9 100644 --- a/tests/php/Chat/NotifierTest.php +++ b/tests/php/Chat/NotifierTest.php @@ -129,20 +129,24 @@ class NotifierTest extends TestCase { /** * @return Room|MockObject */ - private function getRoom() { + private function getRoom($settings = []) { /** @var Room|MockObject */ $room = $this->createMock(Room::class); $room->expects($this->any()) ->method('getParticipant') - ->willReturnCallback(function (string $actorId) use ($room): Participant { + ->willReturnCallback(function (string $actorId) use ($room, $settings): Participant { if ($actorId === 'userNotInOneToOneChat') { throw new ParticipantNotFoundException(); } - $attendee = Attendee::fromRow([ + $attendeeRow = [ 'actor_type' => 'user', 'actor_id' => $actorId, - ]); + ]; + if (isset($settings['attendee'][$actorId])) { + $attendeeRow = array_merge($attendeeRow, $settings['attendee'][$actorId]); + } + $attendee = Attendee::fromRow($attendeeRow); return new Participant($room, $attendee, null); }); @@ -380,19 +384,20 @@ class NotifierTest extends TestCase { $this->notificationManager->expects($this->exactly($notify)) ->method('notify'); - $room = $this->getRoom(); + $room = $this->getRoom([ + 'attendee' => [ + 'testUser' => [ + 'notificationLevel' => $notifyType, + ] + ] + ]); $room->method('getType') ->willReturn($roomType); $comment = $this->newComment('108', 'users', 'testUser', new \DateTime('@' . 1000000016), 'message'); - - $this->config - ->expects($this->any()) - ->method('getAppValue') - ->with('spreed', 'default_group_notification', Participant::NOTIFY_MENTION) - ->willReturn($notifyType); + $reaction = $this->newComment('108', 'users', $authorId, new \DateTime('@' . 1000000016), 'message'); $notifier = $this->getNotifier([]); - $notifier->notifyReacted($room, $comment, $authorId); + $notifier->notifyReacted($room, $comment, $reaction); } public function dataNotifyReacted(): array { |