diff options
author | Sergio Bertolin <sbertolin@solidgear.es> | 2016-11-23 09:43:55 +0000 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-12-22 12:49:39 +0100 |
commit | b78dcae1d491be99ec6dffa6705b2c987cb1393b (patch) | |
tree | bb07f3ae09744ee4a0264e6d75126869cae74171 /build | |
parent | 7f8d22e7102293d96c365b380bf1845ff2de6b71 (diff) | |
download | nextcloud-server-b78dcae1d491be99ec6dffa6705b2c987cb1393b.tar.gz nextcloud-server-b78dcae1d491be99ec6dffa6705b2c987cb1393b.zip |
WIP commit, adding report support
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 56 | ||||
-rw-r--r-- | build/integration/features/favorites.feature | 12 |
2 files changed, 67 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 6438a871fb1..f19ae1a86ef 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -406,6 +406,40 @@ trait WebDav { return $response; } + /*Returns the elements of a report command*/ + public function reportFolder($user, $path, $properties = null){ + $client = $this->getSabreClient($user); + + $body = [ 'body' => '<?xml version="1.0" encoding="utf-8" ?> + <oc:filter-files xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns" > + <a:prop> + <oc:id/> + <oc:fileid/> + <oc:permissions/> + <a:getlastmodified/> + <a:getetag/> + <oc:downloadURL/> + <oc:ddC/> + <oc:size/> + <oc:owner-id/> + <oc:owner-display-name/> + <oc:size/> + <oc:checksum /> + <oc:tags /> + <a:quota-used-bytes/> + <a:quota-available-bytes/> + <oc:favorite/> + </a:prop> + <oc:filter-rules> + <oc:favorite>1</oc:favorite> + </oc:filter-rules> + </oc:filter-files>']; + + $response = $client->request('REPORT', $this->makeSabrePath($user, $path), $body); + + return $response; + } + public function makeSabrePath($user, $path) { return $this->encodePath($this->getDavFilesPath($user) . $path); } @@ -637,7 +671,6 @@ trait WebDav { $this->asGetsPropertiesOfFolderWith($user, 'entry', $path, $propertiesTable); $pathETAG[$path] = $this->response['{DAV:}getetag']; $this->storedETAG[$user]= $pathETAG; - print_r($this->storedETAG[$user][$path]); } /** @@ -681,4 +714,25 @@ trait WebDav { } } } + + /** + * @Then /^user "([^"]*)" in folder "([^"]*)" should have favorited the following elements$/ + * @param string $user + * @param string $folder + * @param \Behat\Gherkin\Node\TableNode|null $expectedElements + */ + public function checkFavoritedElements($user, $folder, $expectedElements){ + $elementList = $this->reportFolder($user, $folder); + if ($expectedElements instanceof \Behat\Gherkin\Node\TableNode) { + $elementRows = $expectedElements->getRows(); + $elementsSimplified = $this->simplifyArray($elementRows); + foreach($elementsSimplified as $expectedElement) { + $webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement; + if (!array_key_exists($webdavPath,$elementList)){ + PHPUnit_Framework_Assert::fail("$webdavPath" . " is not in report answer"); + } + } + } + } + } diff --git a/build/integration/features/favorites.feature b/build/integration/features/favorites.feature index 5e31e1902f8..a2ee579436e 100644 --- a/build/integration/features/favorites.feature +++ b/build/integration/features/favorites.feature @@ -78,3 +78,15 @@ Feature: favorite |{http://owncloud.org/ns}favorite| And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "" + Scenario: Get favorited elements of a folder + Given using old dav path + And As an "admin" + And user "user0" exists + When user "user0" favorites element "/FOLDER" + And user "user0" favorites element "/textfile0.txt" + And user "user0" favorites element "/textfile1.txt" + Then user "user0" in folder "/" should have favorited the following elements + | /FOLDER | + | /textfile0.txt | + | /textfile1.txt | + |