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-01-28 18:01:46 +0300
committerVitor Mattos <vitor@php.rio>2022-02-15 18:49:52 +0300
commitea189f49d1ee45e366c42fce6946d2122b60bc9c (patch)
treec8548a37a4a1db179db8274fd76732c6446670f3 /tests
parent1a2639714033670444f5a104f2570755d5acfd25 (diff)
Implement tests to validate notify reacted message
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests')
-rw-r--r--tests/php/Chat/NotifierTest.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/php/Chat/NotifierTest.php b/tests/php/Chat/NotifierTest.php
index f3fc6df01..8bcff7e6d 100644
--- a/tests/php/Chat/NotifierTest.php
+++ b/tests/php/Chat/NotifierTest.php
@@ -374,6 +374,43 @@ class NotifierTest extends TestCase {
}
/**
+ * @dataProvider dataNotifyReacted
+ */
+ public function testNotifyReacted(int $notify, int $notifyType, int $roomType, string $authorId): void {
+ $this->notificationManager->expects($this->exactly($notify))
+ ->method('notify');
+
+ $room = $this->getRoom();
+ $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);
+
+ $notifier = $this->getNotifier([]);
+ $notifier->notifyReacted($room, $comment, $authorId);
+ }
+
+ public function dataNotifyReacted(): array {
+ return [
+ 'author react to own message' =>
+ [0, Participant::NOTIFY_MENTION, Room::TYPE_GROUP, 'testUser'],
+ 'notify never' =>
+ [0, Participant::NOTIFY_NEVER, Room::TYPE_GROUP, 'testUser2'],
+ 'notify default, not one to one' =>
+ [0, Participant::NOTIFY_DEFAULT, Room::TYPE_GROUP, 'testUser2'],
+ 'notify default, one to one' =>
+ [1, Participant::NOTIFY_DEFAULT, Room::TYPE_ONE_TO_ONE, 'testUser2'],
+ 'notify always' =>
+ [1, Participant::NOTIFY_ALWAYS, Room::TYPE_GROUP, 'testUser2'],
+ ];
+ }
+
+ /**
* @dataProvider dataGetMentionedUsers
*/
public function testGetMentionedUsers(string $message, array $expectedReturn): void {