Add tests for space notification (#6372)

This commit is contained in:
Amrita
2023-06-08 16:59:45 +05:45
committed by GitHub
parent aac7816a49
commit c750d6677a
6 changed files with 538 additions and 182 deletions
@@ -115,6 +115,28 @@ class NotificationContext implements Context {
Assert::assertNull($notifications, "response should not contain any notification");
}
/**
* @Then /^user "([^"]*)" should have "([^"]*)" notifications$/
*
* @param string $user
* @param int $numberOfNotification
*
* @return void
* @throws Exception
*/
public function userShouldHaveNotifications(string $user, int $numberOfNotification): void {
if (!isset($this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data)) {
throw new Exception("Notification is empty");
}
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data;
$actualNumber = \count($responseBody);
Assert::assertEquals(
$numberOfNotification,
$actualNumber,
"Expected number of notification was '$numberOfNotification', but got '$actualNumber'"
);
}
/**
* @Then /^the JSON response should contain a notification message with the subject "([^"]*)" and the message-details should match$/
*