summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-04-11 11:30:08 +0200
committerJoas Schilling <coding@schilljs.com>2022-04-11 12:16:44 +0200
commit134da749f9235a53942311d6e872ab15c184c3c1 (patch)
tree50f2d00ce2380a488ec883ad2612c5b6437a1b7f /tests
parent2ed5f48cc52491ae6468e997682d728512a1fe46 (diff)
Expose an attribute "self" in the reaction summary with the list of own reactions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php2
-rw-r--r--tests/integration/features/reaction/react.feature4
-rw-r--r--tests/php/Controller/ChatControllerTest.php5
3 files changed, 9 insertions, 2 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 3d0d3dc7b..da36775f0 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -2267,7 +2267,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
/**
* @Given /^user "([^"]*)" retrieve reactions "([^"]*)" of message "([^"]*)" in room "([^"]*)" with (\d+)(?: \((v1)\))?$/
*/
- public function userRetrieveReactionsOfMessageInRoomWith(string $user, string $reaction, string $message, string $identifier, int $statusCode, string $apiVersion = 'v1', TableNode $formData): void {
+ public function userRetrieveReactionsOfMessageInRoomWith(string $user, string $reaction, string $message, string $identifier, int $statusCode, string $apiVersion = 'v1', ?TableNode $formData = null): void {
$token = self::$identifierToToken[$identifier];
$messageId = self::$textToMessageId[$message];
$this->setCurrentUser($user);
diff --git a/tests/integration/features/reaction/react.feature b/tests/integration/features/reaction/react.feature
index f7c796bf1..10ec2901f 100644
--- a/tests/integration/features/reaction/react.feature
+++ b/tests/integration/features/reaction/react.feature
@@ -24,12 +24,14 @@ Feature: reaction/react
| actorType | actorId | actorDisplayName | reaction |
| users | participant1 | participant1-displayname | 👍 |
| users | participant2 | participant2-displayname | 👍 |
+ And user "participant1" react with "🚀" on message "Message 1" to room "room" with 201
Then user "participant1" sees the following messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters | reactions |
- | room | users | participant1 | participant1-displayname | Message 1 | [] | {"👍":2} |
+ | room | users | participant1 | participant1-displayname | Message 1 | [] | {"👍":2,"🚀":1,"self":["👍","🚀"]} |
Then user "participant1" sees the following system messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | systemMessage |
| room | users | participant1 | participant1-displayname | reaction |
+ | room | users | participant1 | participant1-displayname | reaction |
| room | users | participant2 | participant2-displayname | reaction |
| room | users | participant1 | participant1-displayname | user_added |
| room | users | participant1 | participant1-displayname | conversation_created |
diff --git a/tests/php/Controller/ChatControllerTest.php b/tests/php/Controller/ChatControllerTest.php
index 6ea619f1d..9a79d0916 100644
--- a/tests/php/Controller/ChatControllerTest.php
+++ b/tests/php/Controller/ChatControllerTest.php
@@ -26,6 +26,7 @@ namespace OCA\Talk\Tests\php\Controller;
use OCA\Talk\Chat\AutoComplete\SearchPlugin;
use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Chat\MessageParser;
+use OCA\Talk\Chat\ReactionManager;
use OCA\Talk\Controller\ChatController;
use OCA\Talk\GuestManager;
use OCA\Talk\MatterbridgeManager;
@@ -63,6 +64,8 @@ class ChatControllerTest extends TestCase {
private $appManager;
/** @var ChatManager|MockObject */
protected $chatManager;
+ /** @var ReactionManager|MockObject */
+ protected $reactionManager;
/** @var ParticipantService|MockObject */
protected $participantService;
/** @var SessionService|MockObject */
@@ -109,6 +112,7 @@ class ChatControllerTest extends TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->chatManager = $this->createMock(ChatManager::class);
+ $this->reactionManager = $this->createMock(ReactionManager::class);
$this->participantService = $this->createMock(ParticipantService::class);
$this->sessionService = $this->createMock(SessionService::class);
$this->attachmentService = $this->createMock(AttachmentService::class);
@@ -145,6 +149,7 @@ class ChatControllerTest extends TestCase {
$this->userManager,
$this->appManager,
$this->chatManager,
+ $this->reactionManager,
$this->participantService,
$this->sessionService,
$this->attachmentService,