diff options
author | Joas Schilling <coding@schilljs.com> | 2017-11-20 12:36:40 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-11-20 15:53:59 +0300 |
commit | 335ad722c2e0e70067b906f39ad1f2e5617d10fc (patch) | |
tree | 587980c63c5538bb9d6752a112ed45cc3bc55b9f /tests | |
parent | f4308ef428939f50fc4548fbc62c805338ee18ca (diff) |
Mark mention notifications as read, when the user pulls the chat messages of the room
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/php/Chat/ChatManagerTest.php | 18 | ||||
-rw-r--r-- | tests/php/Controller/ChatControllerTest.php | 10 |
2 files changed, 20 insertions, 8 deletions
diff --git a/tests/php/Chat/ChatManagerTest.php b/tests/php/Chat/ChatManagerTest.php index 131b11d99..22e470a70 100644 --- a/tests/php/Chat/ChatManagerTest.php +++ b/tests/php/Chat/ChatManagerTest.php @@ -121,8 +121,12 @@ class ChatManagerTest extends \Test\TestCase { $this->newComment(108, 'users', 'testUser', new \DateTime('@' . 1000000016), 'testMessage1') ]); + $this->notifier->expects($this->once()) + ->method('markMentionNotificationsRead') + ->with('testChatId', 'userId'); + $timeout = 42; - $comments = $this->chatManager->receiveMessages('testChatId', $timeout, $offset, $notOlderThan); + $comments = $this->chatManager->receiveMessages('testChatId', 'userId', $timeout, $offset, $notOlderThan); $expected = [ $this->newComment(110, 'users', 'testUnknownUser', new \DateTime('@' . 1000000042), 'testMessage3'), $this->newComment(109, 'guests', 'testSpreedSession', new \DateTime('@' . 1000000023), 'testMessage2') @@ -154,8 +158,12 @@ class ChatManagerTest extends \Test\TestCase { $this->newComment(108, 'users', 'testUser', new \DateTime('@' . 1000000016), 'testMessage1') ]); + $this->notifier->expects($this->once()) + ->method('markMentionNotificationsRead') + ->with('testChatId', 'userId'); + $timeout = 42; - $comments = $this->chatManager->receiveMessages('testChatId', $timeout, $offset, $notOlderThan); + $comments = $this->chatManager->receiveMessages('testChatId', 'userId', $timeout, $offset, $notOlderThan); $expected = [ $this->newComment(111, 'users', 'testUser', new \DateTime('@' . 1000000108), 'testMessage4'), $this->newComment(110, 'users', 'testUnknownUser', new \DateTime('@' . 1000000042), 'testMessage3'), @@ -185,8 +193,12 @@ class ChatManagerTest extends \Test\TestCase { $this->newComment(108, 'users', 'testUser', new \DateTime('@' . 1000000016), 'testMessage1') ]); + $this->notifier->expects($this->once()) + ->method('markMentionNotificationsRead') + ->with('testChatId', 'userId'); + $timeout = 42; - $comments = $this->chatManager->receiveMessages('testChatId', $timeout, $offset, $notOlderThan); + $comments = $this->chatManager->receiveMessages('testChatId', 'userId', $timeout, $offset, $notOlderThan); $expected = [ $this->newComment(110, 'users', 'testUnknownUser', new \DateTime('@' . 1000000042), 'testMessage3'), $this->newComment(109, 'guests', 'testSpreedSession', new \DateTime('@' . 1000000023), 'testMessage2'), diff --git a/tests/php/Controller/ChatControllerTest.php b/tests/php/Controller/ChatControllerTest.php index e349a75d7..827f4ac2c 100644 --- a/tests/php/Controller/ChatControllerTest.php +++ b/tests/php/Controller/ChatControllerTest.php @@ -319,7 +319,7 @@ class ChatControllerTest extends \Test\TestCase { $timestamp = 1000000000; $this->chatManager->expects($this->once()) ->method('receiveMessages') - ->with('1234', $timeout, $offset, new \DateTime('@' . $timestamp)) + ->with('1234', $this->userId, $timeout, $offset, new \DateTime('@' . $timestamp)) ->willReturn([ $this->newComment(111, 'users', 'testUser', new \DateTime('@' . 1000000016), 'testMessage4'), $this->newComment(110, 'users', 'testUnknownUser', new \DateTime('@' . 1000000015), 'testMessage3'), @@ -377,7 +377,7 @@ class ChatControllerTest extends \Test\TestCase { $timestamp = 1000000000; $this->chatManager->expects($this->once()) ->method('receiveMessages') - ->with('1234', $timeout, $offset, new \DateTime('@' . $timestamp)) + ->with('1234', $this->userId, $timeout, $offset, new \DateTime('@' . $timestamp)) ->willReturn([ $this->newComment(111, 'users', 'testUser', new \DateTime('@' . 1000000016), 'testMessage4'), $this->newComment(110, 'users', 'testUnknownUser', new \DateTime('@' . 1000000015), 'testMessage3'), @@ -465,7 +465,7 @@ class ChatControllerTest extends \Test\TestCase { $timestamp = 1000000000; $this->chatManager->expects($this->once()) ->method('receiveMessages') - ->with('1234', $timeout, $offset, new \DateTime('@' . $timestamp)) + ->with('1234', null, $timeout, $offset, new \DateTime('@' . $timestamp)) ->willReturn([ $this->newComment(111, 'users', 'testUser', new \DateTime('@' . 1000000016), 'testMessage4'), $this->newComment(110, 'users', 'testUnknownUser', new \DateTime('@' . 1000000015), 'testMessage3'), @@ -546,7 +546,7 @@ class ChatControllerTest extends \Test\TestCase { $timestamp = 1000000000; $this->chatManager->expects($this->once()) ->method('receiveMessages') - ->with('1234', $timeout, $offset, new \DateTime('@' . $timestamp)) + ->with('1234', $this->userId, $timeout, $offset, new \DateTime('@' . $timestamp)) ->willReturn([]); $response = $this->controller->receiveMessages('testToken', $offset, $timestamp, $timeout); @@ -579,7 +579,7 @@ class ChatControllerTest extends \Test\TestCase { $timestamp = 1000000000; $this->chatManager->expects($this->once()) ->method('receiveMessages') - ->with('1234', $maximumTimeout, $offset, new \DateTime('@' . $timestamp)) + ->with('1234', $this->userId, $maximumTimeout, $offset, new \DateTime('@' . $timestamp)) ->willReturn([]); $response = $this->controller->receiveMessages('testToken', $offset, $timestamp, $timeout); |