diff options
author | Vitor Mattos <vitor@php.rio> | 2022-07-14 01:22:36 +0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-07-15 15:38:52 +0300 |
commit | 73d85045d5d84e398f0c763c608ba34c1719b139 (patch) | |
tree | 0791ffe2b48451b417ce2417ee53a37f23bc389c | |
parent | 5b093f344527140c37247965f5ff30924328364d (diff) |
Integration tests
Signed-off-by: Vitor Mattos <vitor@php.rio>
3 files changed, 31 insertions, 1 deletions
diff --git a/tests/integration/features/bootstrap/CommandLineTrait.php b/tests/integration/features/bootstrap/CommandLineTrait.php index e8e73ffd0..b30904729 100644 --- a/tests/integration/features/bootstrap/CommandLineTrait.php +++ b/tests/integration/features/bootstrap/CommandLineTrait.php @@ -78,6 +78,9 @@ trait CommandLineTrait { * @Given /^invoking occ with "([^"]*)"$/ */ public function invokingTheCommand($cmd) { + if (preg_match('/room-name:(?P<token>\w+)/', $cmd, $matches)) { + $cmd = preg_replace('/room-name:(\w+)/', self::$identifierToToken[$matches['token']], $cmd); + } $args = explode(' ', $cmd); $this->runOcc($args); } diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 2e567b694..82208d6c0 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -2598,7 +2598,7 @@ class FeatureContext implements Context, SnippetAcceptingContext { $response = $this->getDataFromResponse($this->response); Assert::assertIsArray($response, 'Job not found'); Assert::assertArrayHasKey('id', $response, 'Job not found'); - $this->runOcc(['background-job:execute', $response['id']]); + $this->runOcc(['background-job:execute', $response['id'], '--force-execute']); $this->setCurrentUser($currentUser); } diff --git a/tests/integration/features/command/message-expiration.feature b/tests/integration/features/command/message-expiration.feature new file mode 100644 index 000000000..9e1605fba --- /dev/null +++ b/tests/integration/features/command/message-expiration.feature @@ -0,0 +1,27 @@ +Feature: command/message-expiration + Background: + Given user "participant1" exists + + Scenario: Enable message expiration and check after expire + Given user "participant1" creates room "room1" (v4) + | roomType | 3 | + | roomName | room1 | + And user "participant1" sends message "Message 1" to room "room1" with 201 + And user "participant1" set the message expiration to 3 of room "room1" with 200 (v4) + And invoking occ with "talk:room:message-expiration room-name:room1 --seconds=3" + And the command output contains the text "Message expiration enabled successful as 3 seconds." + And user "participant1" sends message "Message 2" to room "room1" with 201 + And wait for 3 seconds + And apply message expiration job manually + Then user "participant1" sees the following messages in room "room1" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | + | room1 | users | participant1 | participant1-displayname | Message 1 | [] | | + And invoking occ with "talk:room:message-expiration room-name:room1 --seconds=0" + And the command output contains the text "Message expiration disabled successful." + And user "participant1" sends message "Message 3" to room "room1" with 201 + And wait for 3 seconds + And apply message expiration job manually + And user "participant1" sees the following messages in room "room1" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | + | room1 | users | participant1 | participant1-displayname | Message 3 | [] | | + | room1 | users | participant1 | participant1-displayname | Message 1 | [] | | |