diff options
author | Sergio Bertolin <sbertolin@solidgear.es> | 2015-09-30 15:50:18 +0000 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2015-10-06 10:30:31 +0200 |
commit | 0e3836ed48bfa14d15a2a32efd4fdc3a125e0c2b (patch) | |
tree | f359579f2a4a0e202fbf8cb4b803fa4c0037ad70 /build/integration/features/bootstrap/FeatureContext.php | |
parent | 186aff5deaf2b4f88945d6e5ca12ffb48190a3a7 (diff) | |
download | nextcloud-server-0e3836ed48bfa14d15a2a32efd4fdc3a125e0c2b.tar.gz nextcloud-server-0e3836ed48bfa14d15a2a32efd4fdc3a125e0c2b.zip |
Return the actual ocs return codes and check it
Diffstat (limited to 'build/integration/features/bootstrap/FeatureContext.php')
-rw-r--r-- | build/integration/features/bootstrap/FeatureContext.php | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index bd96304824a..da5b62153b8 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -49,13 +49,28 @@ class FeatureContext extends BehatContext { $this->sendingToWith($verb, $url, null); } - /** + // /** + // * @Then /^the status code should be "([^"]*)"$/ + // */ + // public function theStatusCodeShouldBe($statusCode) { + // PHPUnit_Framework_Assert::assertEquals($statusCode, $this->response->getStatusCode()); + // } + + + public function getOCSResponse($response){ + return $response->xml()->meta[0]->statuscode; + } + + + + /** * @Then /^the status code should be "([^"]*)"$/ */ public function theStatusCodeShouldBe($statusCode) { - PHPUnit_Framework_Assert::assertEquals($statusCode, $this->response->getStatusCode()); + PHPUnit_Framework_Assert::assertEquals($statusCode, $this->getOCSResponse($this->response)); } + /** * @Given /^As an "([^"]*)"$/ */ @@ -74,7 +89,7 @@ class FeatureContext extends BehatContext { * @Given /^user "([^"]*)" exists$/ */ public function userExists($user) { - $fullUrl = $this->baseUrl . "v2.php/cloud/users/$user"; + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user"; $client = new Client(); $options = []; if ($this->currentUser === 'admin') { @@ -82,7 +97,6 @@ class FeatureContext extends BehatContext { } $this->response = $client->get($fullUrl, $options); - PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); } /** @@ -92,15 +106,16 @@ class FeatureContext extends BehatContext { try { $this->userExists($user); } catch (\GuzzleHttp\Exception\ClientException $ex) { - PHPUnit_Framework_Assert::assertEquals(404, $ex->getResponse()->getStatusCode()); + $this->response = $ex->getResponse(); } } + /** * @When /^creating the user "([^"]*)r"$/ */ public function creatingTheUser($user) { - $fullUrl = $this->baseUrl . "v2.php/cloud/users/$user"; + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user" ; $client = new Client(); $options = []; if ($this->currentUser === 'admin') { @@ -113,7 +128,7 @@ class FeatureContext extends BehatContext { 'password' => '123456' ] ]); - PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); + } @@ -133,7 +148,6 @@ class FeatureContext extends BehatContext { 'groupid' => $user ] ]); - PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); } @@ -141,7 +155,7 @@ class FeatureContext extends BehatContext { * @Given /^group "([^"]*)" exists$/ */ public function groupExists($group) { - $fullUrl = $this->baseUrl . "v2.php/cloud/groups/$group"; + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/groups/$group"; $client = new Client(); $options = []; if ($this->currentUser === 'admin') { @@ -149,7 +163,6 @@ class FeatureContext extends BehatContext { } $this->response = $client->get($fullUrl, $options); - PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); } /** @@ -159,7 +172,7 @@ class FeatureContext extends BehatContext { try { $this->groupExists($group); } catch (\GuzzleHttp\Exception\ClientException $ex) { - PHPUnit_Framework_Assert::assertEquals(404, $ex->getResponse()->getStatusCode()); + $this->response = $ex->getResponse(); } } @@ -187,4 +200,9 @@ class FeatureContext extends BehatContext { } } + + + + + } |