Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

Commit

Permalink
Improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Dolbeau committed Jan 16, 2020
1 parent 958bb17 commit 31f96e3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/FunctionalTests/ConversationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Shapin\TalkJS\Model\Conversation\ConversationCreatedOrUpdated;
use Shapin\TalkJS\Model\Conversation\ConversationJoined;
use Shapin\TalkJS\Model\Conversation\ConversationLeft;
use Shapin\TalkJS\Model\Conversation\Message;
use Shapin\TalkJS\Model\Conversation\MessageCollection;
use Shapin\TalkJS\Model\Conversation\MessageCreated;
use Shapin\TalkJS\Model\Conversation\ParticipationUpdated;
Expand Down Expand Up @@ -112,7 +113,8 @@ public function testAll()
$messages = $this->api->findMessages($conversationId);
$this->assertInstanceOf(MessageCollection::class, $messages);
$this->assertCount(1, $messages);
$message = reset($messages);
$message = $messages->getIterator()->current();
$this->assertInstanceOf(Message::class, $message);
$this->assertTrue($message->isSystemMessage());
$this->assertSame('An amazing system message', $message->getText());
$this->assertNull($message->getSenderId());
Expand All @@ -131,7 +133,8 @@ public function testAll()
$messages = $this->api->findMessages($conversationId);
$this->assertInstanceOf(MessageCollection::class, $messages);
$this->assertCount(2, $messages);
$message = reset($messages);
$message = $messages->getIterator()->current();
$this->assertInstanceOf(Message::class, $message);
$this->assertTrue($message->isUserMessage());
$this->assertSame('An amazing user message', $message->getText());
$this->assertSame('my_user', $message->getSenderId());
Expand Down

0 comments on commit 31f96e3

Please sign in to comment.