diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-03-17 15:50:33 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-03-17 16:54:54 +0100 |
commit | 85f363ba2cf1f9024337ea5eb5ea271937f0af6f (patch) | |
tree | c51929b6ded306dad08d4b75c3aa0814e74da295 /build/integration/features/bootstrap/WebDav.php | |
parent | 950530b162cb109d258ba23d041e8fd98c9a936e (diff) | |
download | nextcloud-server-85f363ba2cf1f9024337ea5eb5ea271937f0af6f.tar.gz nextcloud-server-85f363ba2cf1f9024337ea5eb5ea271937f0af6f.zip |
Add intergration tests
Intergration tests to ensure the share-types property is set correctly.
* Unshared item
* Shared with user
* Shared with group
* Shared by link
* Shared with user & group & link
Diffstat (limited to 'build/integration/features/bootstrap/WebDav.php')
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 95a05f4ed6f..b56a1b7d2f6 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -190,7 +190,7 @@ trait WebDav { */ public function theSingleResponseShouldContainAPropertyWithValue($key, $expectedValue) { $keys = $this->response; - if (!isset($keys[$key])) { + if (!array_key_exists($key, $keys)) { throw new \Exception("Cannot find property \"$key\" with \"$expectedValue\""); } @@ -200,6 +200,57 @@ trait WebDav { } } + /** + * @Then the response should contain a share-types property with + */ + public function theResponseShouldContainAShareTypesPropertyWith($table) + { + $keys = $this->response; + if (!array_key_exists('{http://owncloud.org/ns}share-types', $keys)) { + throw new \Exception("Cannot find property \"{http://owncloud.org/ns}share-types\""); + } + + $foundTypes = []; + $data = $keys['{http://owncloud.org/ns}share-types']; + foreach ($data as $item) { + if ($item['name'] !== '{http://owncloud.org/ns}share-type') { + throw new \Exception('Invalid property found: "' . $item['name'] . '"'); + } + + $foundTypes[] = $item['value']; + } + + foreach ($table->getRows() as $row) { + $key = array_search($row[0], $foundTypes); + if ($key === false) { + throw new \Exception('Expected type ' . $row[0] . ' not found'); + } + + unset($foundTypes[$key]); + } + + if ($foundTypes !== []) { + throw new \Exception('Found more share types then specified: ' . $foundTypes); + } + } + + /** + * @Then the response should contain an empty property :property + * @param string $property + * @throws \Exception + */ + public function theResponseShouldContainAnEmptyProperty($property) { + $properties = $this->response; + if (!array_key_exists($property, $properties)) { + throw new \Exception("Cannot find property \"$property\""); + } + + if ($properties[$property] !== null) { + throw new \Exception("Property \"$property\" is not empty"); + } + } + + /*Returns the elements of a propfind, $folderDepth requires 1 to see elements without children*/ public function listFolder($user, $path, $folderDepth, $properties = null){ $fullUrl = substr($this->baseUrl, 0, -4); |