summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/integration/features/bootstrap/WebDav.php56
-rw-r--r--build/integration/features/favorites.feature12
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 |
+