Commit a2938385 authored by Sergio Bertolin's avatar Sergio Bertolin
Browse files

Making webdav path configurable

parent dd10e1d5
......@@ -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);
}
......
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
......
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"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment