diff options
author | Sergio Bertolin <sbertolin@solidgear.es> | 2015-09-29 14:52:19 +0000 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2015-10-06 10:30:31 +0200 |
commit | 583c082acf16cde33bac780285f1bd391e961b4e (patch) | |
tree | 08254cfb0ccef79f559ff0b94385da0d0d9c32c6 /build/integration/features/bootstrap/FeatureContext.php | |
parent | da640adf688baef651df08a81e04089553a6c3a0 (diff) | |
download | nextcloud-server-583c082acf16cde33bac780285f1bd391e961b4e.tar.gz nextcloud-server-583c082acf16cde33bac780285f1bd391e961b4e.zip |
added some group logic
Diffstat (limited to 'build/integration/features/bootstrap/FeatureContext.php')
-rw-r--r-- | build/integration/features/bootstrap/FeatureContext.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index b7a04e1ca76..feaa6cdd0f8 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -116,6 +116,55 @@ class FeatureContext extends BehatContext { PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); } + + /** + * @When /^creating the group "([^"]*)r"$/ + */ + public function creatingTheGroup($group) { + $fullUrl = $this->baseUrl . "v2.php/cloud/users/$user"; + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/groups/addgroup" ; + $client = new Client(); + $options = []; + if ($this->currentUser === 'admin') { + $options['auth'] = $this->adminUser; + } + + $this->response = $client->post($fullUrl, [ + 'form_params' => [ + 'groupid' => $user + ] + ]); + PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); + } + + + /** + * @Given /^group "([^"]*)" exists$/ + */ + public function groupExists($group) { + $fullUrl = $this->baseUrl . "v2.php/cloud/groups/$group"; + $client = new Client(); + $options = []; + if ($this->currentUser === 'admin') { + $options['auth'] = $this->adminUser; + } + + $this->response = $client->get($fullUrl, $options); + PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); + } + + /** + * @Given /^group "([^"]*)" does not exist$/ + */ + public function groupDoesNotExist($group) { + try { + $this->groupExists($group); + } catch (\GuzzleHttp\Exception\ClientException $ex) { + PHPUnit_Framework_Assert::assertEquals(404, $ex->getResponse()->getStatusCode()); + } + } + + /** * @When /^sending "([^"]*)" to "([^"]*)" with$/ * @param \Behat\Gherkin\Node\TableNode|null $formData |