summaryrefslogtreecommitdiffstats
path: root/build/integration/features/bootstrap/WebDav.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-06-21 11:18:22 +0200
committerLukas Reschke <lukas@owncloud.com>2016-06-21 11:18:22 +0200
commit2b493e2f9dca674ba11f88a1d182d6872e04eaaa (patch)
treeef7fa75d1b4da812de80e93c3590dbb5404d7f06 /build/integration/features/bootstrap/WebDav.php
parentb4df57f3f02f65ed71d1072280751170379a53e8 (diff)
parent0e575c7eeadc6c8eb11b0be2ed1d39cdcf6cfcb8 (diff)
downloadnextcloud-server-2b493e2f9dca674ba11f88a1d182d6872e04eaaa.tar.gz
nextcloud-server-2b493e2f9dca674ba11f88a1d182d6872e04eaaa.zip
Merge remote-tracking branch 'upstream/master' into master-sync-upstream
Diffstat (limited to 'build/integration/features/bootstrap/WebDav.php')
-rw-r--r--build/integration/features/bootstrap/WebDav.php50
1 files changed, 48 insertions, 2 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index cd9584ad186..0abb8667739 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -214,7 +214,7 @@ trait WebDav {
}
$value = $keys[$key];
- if ($value !== $expectedValue) {
+ if ($value != $expectedValue) {
throw new \Exception("Property \"$key\" found with value \"$value\", expected \"$expectedValue\"");
}
}
@@ -434,5 +434,51 @@ trait WebDav {
$this->response = $ex->getResponse();
}
}
-}
+ /**
+ * @When user :user favorites element :path
+ */
+ public function userFavoritesElement($user, $path){
+ $this->response = $this->changeFavStateOfAnElement($user, $path, 1, 0, null);
+ }
+
+ /**
+ * @When user :user unfavorites element :path
+ */
+ public function userUnfavoritesElement($user, $path){
+ $this->response = $this->changeFavStateOfAnElement($user, $path, 0, 0, null);
+ }
+
+ /*Set the elements of a proppatch, $folderDepth requires 1 to see elements without children*/
+ public function changeFavStateOfAnElement($user, $path, $favOrUnfav, $folderDepth, $properties = null){
+ $fullUrl = substr($this->baseUrl, 0, -4);
+ $settings = array(
+ 'baseUri' => $fullUrl,
+ 'userName' => $user,
+ );
+ if ($user === 'admin') {
+ $settings['password'] = $this->adminUser[1];
+ } else {
+ $settings['password'] = $this->regularUser;
+ }
+ $client = new SClient($settings);
+ if (!$properties) {
+ $properties = [
+ '{http://owncloud.org/ns}favorite' => $favOrUnfav
+ ];
+ }
+
+ $response = $client->proppatch($this->davPath . '/' . ltrim($path, '/'), $properties, $folderDepth);
+ return $response;
+ }
+
+ /**
+ * @Then /^as "([^"]*)" gets properties of file "([^"]*)" with$/
+ * @param string $user
+ * @param string $path
+ * @param \Behat\Gherkin\Node\TableNode|null $propertiesTable
+ */
+ public function asGetsPropertiesOfFileWith($user, $path, $propertiesTable) {
+ $this->asGetsPropertiesOfFolderWith($user, $path, $propertiesTable);
+ }
+}