summaryrefslogtreecommitdiffstats
path: root/build/integration/features/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'build/integration/features/bootstrap')
-rw-r--r--build/integration/features/bootstrap/Provisioning.php8
-rw-r--r--build/integration/features/bootstrap/Sharing.php16
-rw-r--r--build/integration/features/bootstrap/WebDav.php47
3 files changed, 60 insertions, 11 deletions
diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php
index 65a6611b06c..6d710b2016f 100644
--- a/build/integration/features/bootstrap/Provisioning.php
+++ b/build/integration/features/bootstrap/Provisioning.php
@@ -531,6 +531,14 @@ trait Provisioning {
}
/**
+ * @Given user :user has unlimited quota
+ */
+ public function userHasUnlimitedQuota($user)
+ {
+ $this->userHasAQuotaOf($user, 'none');
+ }
+
+ /**
* @BeforeScenario
* @AfterScenario
*/
diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php
index faf8e0bf507..ec270ef05ce 100644
--- a/build/integration/features/bootstrap/Sharing.php
+++ b/build/integration/features/bootstrap/Sharing.php
@@ -18,17 +18,17 @@ trait Sharing{
private $lastShareData = null;
/**
- * @When /^creating a share with$/
+ * @Given /^as "([^"]*)" creating a share with$/
* @param \Behat\Gherkin\Node\TableNode|null $formData
*/
- public function creatingShare($body) {
+ public function asCreatingAShareWith($user, $body) {
$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v1/shares";
$client = new Client();
$options = [];
- if ($this->currentUser === 'admin') {
+ if ($user === 'admin') {
$options['auth'] = $this->adminUser;
} else {
- $options['auth'] = [$this->currentUser, $this->regularUser];
+ $options['auth'] = [$user, $this->regularUser];
}
if ($body instanceof \Behat\Gherkin\Node\TableNode) {
@@ -50,6 +50,14 @@ trait Sharing{
}
/**
+ * @When /^creating a share with$/
+ * @param \Behat\Gherkin\Node\TableNode|null $formData
+ */
+ public function creatingShare($body) {
+ return $this->asCreatingAShareWith($this->currentUser, $body);
+ }
+
+ /**
* @Then /^Public shared file "([^"]*)" can be downloaded$/
*/
public function checkPublicSharedFile($filename) {
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index be87a09731b..fa6761d9f71 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -20,7 +20,7 @@ trait WebDav {
*/
public function usingDavPath($davPath) {
$this->davPath = $davPath;
- }
+ }
public function makeDavRequest($user, $method, $path, $headers, $body = null){
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . "$path";
@@ -34,7 +34,7 @@ trait WebDav {
$request = $client->createRequest($method, $fullUrl, $options);
if (!is_null($headers)){
foreach ($headers as $key => $value) {
- $request->addHeader($key, $value);
+ $request->addHeader($key, $value);
}
}
@@ -84,7 +84,7 @@ trait WebDav {
$client = new GClient();
$options = [];
$options['auth'] = [$token, ""];
-
+
$request = $client->createRequest("GET", $fullUrl, $options);
$request->addHeader('Range', $range);
@@ -149,8 +149,37 @@ trait WebDav {
}
}
+ /**
+ * @Then /^as "([^"]*)" gets properties of folder "([^"]*)" with$/
+ * @param \Behat\Gherkin\Node\TableNode|null $propertiesTable
+ */
+ public function asGetsPropertiesOfFolderWith($user, $path, $propertiesTable) {
+ $properties = null;
+ if ($propertiesTable instanceof \Behat\Gherkin\Node\TableNode) {
+ foreach ($propertiesTable->getRows() as $row) {
+ $properties[] = $row[0];
+ }
+ }
+ $this->response = $this->listFolder($user, $path, 0, $properties);
+ }
+
+ /**
+ * @Then the single response should contain a property :key with value :value
+ */
+ public function theSingleResponseShouldContainAPropertyWithValue($key, $expectedValue) {
+ $keys = $this->response;
+ if (!isset($keys[$key])) {
+ throw new \Exception("Cannot find property \"$key\" with \"$expectedalue\"");
+ }
+
+ $value = $keys[$key];
+ if ($value !== $expectedValue) {
+ throw new \Exception("Property \"$key\" found with value \"$value\", expected \"$expectedValue\"");
+ }
+ }
+
/*Returns the elements of a propfind, $folderDepth requires 1 to see elements without children*/
- public function listFolder($user, $path, $folderDepth){
+ public function listFolder($user, $path, $folderDepth, $properties = null){
$fullUrl = substr($this->baseUrl, 0, -4);
$settings = array(
@@ -166,9 +195,13 @@ trait WebDav {
$client = new SClient($settings);
- $response = $client->propfind($this->davPath . "/", array(
- '{DAV:}getetag'
- ), $folderDepth);
+ if (!$properties) {
+ $properties = [
+ '{DAV:}getetag'
+ ];
+ }
+
+ $response = $client->propfind($this->davPath . '/' . ltrim($path, '/'), $properties, $folderDepth);
return $response;
}