diff options
author | Joas Schilling <coding@schilljs.com> | 2016-09-05 16:43:26 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-09-05 16:43:26 +0300 |
commit | b489c001a7f7561c71bbc3f438bad15ecdc9b43e (patch) | |
tree | 74a869a51c87084c7c4ba571477cd9213e79b38d /tests/Integration | |
parent | 45b996ba4477021fae453f1ae6b14bd10fae8433 (diff) |
Add a broken integration test for rullzer
Diffstat (limited to 'tests/Integration')
-rw-r--r-- | tests/Integration/features/bootstrap/FeatureContext.php | 15 | ||||
-rw-r--r-- | tests/Integration/features/delete-notifications.feature | 13 |
2 files changed, 26 insertions, 2 deletions
diff --git a/tests/Integration/features/bootstrap/FeatureContext.php b/tests/Integration/features/bootstrap/FeatureContext.php index bac6440..c858aa2 100644 --- a/tests/Integration/features/bootstrap/FeatureContext.php +++ b/tests/Integration/features/bootstrap/FeatureContext.php @@ -159,7 +159,7 @@ class FeatureContext implements Context, SnippetAcceptingContext { } /** - * @Then /^delete (first|last) notification$/ + * @Then /^delete (first|last|same) notification$/ * * @param string $firstOrLast */ @@ -168,13 +168,24 @@ class FeatureContext implements Context, SnippetAcceptingContext { $lastNotificationIds = end($this->notificationIds); if ($firstOrLast === 'first') { $this->deletedNotification = end($lastNotificationIds); - } else { + } else if ($firstOrLast === 'last') { $this->deletedNotification = reset($lastNotificationIds); } $this->sendingTo('DELETE', '/apps/notifications/api/v1/notifications/' . $this->deletedNotification); } /** + * @Then /^status code is ([0-9]*) and ocs code ([0-9]*)$/ + * + * @param int $status + * @param int $ocs + */ + public function assertStatusCode($status, $ocs) { + PHPUnit_Framework_Assert::assertEquals($status, $this->response->getStatusCode()); + PHPUnit_Framework_Assert::assertEquals($ocs, $this->getOCSResponse($this->response)); + } + + /** * Parses the xml answer to get the array of users returned. * @param ResponseInterface $resp * @return array diff --git a/tests/Integration/features/delete-notifications.feature b/tests/Integration/features/delete-notifications.feature index 01d5258..f1d8aeb 100644 --- a/tests/Integration/features/delete-notifications.feature +++ b/tests/Integration/features/delete-notifications.feature @@ -9,6 +9,18 @@ Feature: delete-notifications Given user "test1" has notifications Then user "test1" has 3 notifications And delete first notification + And status code is 200 and ocs code 100 + And user "test1" has 2 notifications missing the first one + + Scenario: Delete same notification twice + Given user "test1" has notifications + Given user "test1" has notifications + Given user "test1" has notifications + When user "test1" has 3 notifications + And delete first notification + And status code is 200 and ocs code 100 + And delete same notification + And status code is 404 and ocs code 404 And user "test1" has 2 notifications missing the first one Scenario: Delete last notification @@ -17,4 +29,5 @@ Feature: delete-notifications Given user "test1" has notifications Then user "test1" has 3 notifications And delete last notification + And status code is 200 and ocs code 100 And user "test1" has 2 notifications missing the last one |