Making webdav path configurable

This commit is contained in:
Sergio Bertolin 2015-11-20 11:26:52 +00:00
parent dd10e1d538
commit a2938385f9
3 changed files with 23 additions and 9 deletions

View File

@ -27,6 +27,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
/** @var int */
private $sharingApiVersion = 1;
/** @var string*/
private $davPath = "remote.php/webdav";
/** @var SimpleXMLElement */
private $lastShareData = null;
@ -211,6 +214,13 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$this->apiVersion = $version;
}
/**
* @Given /^using dav path "([^"]*)"$/
*/
public function usingDavPath($davPath) {
$this->davPath = $davPath;
}
/**
* @Given /^user "([^"]*)" exists$/
*/
@ -906,7 +916,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
public function makeDavRequest($user, $method, $path, $headers){
$fullUrl = substr($this->baseUrl, 0, -4) . "remote.php/webdav" . "$path";
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . "$path";
$client = new Client();
$options = [];
if ($user === 'admin') {
@ -926,7 +936,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
* @Given /^User "([^"]*)" moved file "([^"]*)" to "([^"]*)"$/
*/
public function userMovedFile($user, $fileSource, $fileDestination){
$fullUrl = substr($this->baseUrl, 0, -4) . "remote.php/webdav";
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
$headers['Destination'] = $fullUrl . $fileDestination;
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
PHPUnit_Framework_Assert::assertEquals(201, $this->response->getStatusCode());
@ -936,7 +946,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
* @When /^User "([^"]*)" moves file "([^"]*)" to "([^"]*)"$/
*/
public function userMovesFile($user, $fileSource, $fileDestination){
$fullUrl = substr($this->baseUrl, 0, -4) . "remote.php/webdav";
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
$headers['Destination'] = $fullUrl . $fileDestination;
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
}

View File

@ -1,6 +1,7 @@
Feature: sharing
Background:
Given using api version "1"
Given using dav path "remote.php/webdav"
Scenario: Creating a new share with user
Given user "user0" exists

View File

@ -1,12 +1,15 @@
Feature: sharing
Background:
Given using api version "1"
Given using api version "1"
Scenario: moving a file old way
Given using dav path "remote.php/webdav"
And As an "admin"
And user "user0" exists
When User "user0" moves file "/textfile0.txt" to "/FOLDER/textfile0.txt"
Then the HTTP status code should be "201"
Scenario: moving a file
Given As an "admin"
And user "user0" exists
When User "user0" moves file "/textfile0.txt" to "/FOLDER/textfile0.txt"
Then the HTTP status code should be "201"