Skip to content
Snippets Groups Projects
Unverified Commit 09a90b40 authored by Sergio Bertolin's avatar Sergio Bertolin Committed by Roeland Jago Douma
Browse files

User was incorrect

parent d81f4ea5
No related branches found
No related tags found
No related merge requests found
...@@ -53,9 +53,9 @@ trait WebDav { ...@@ -53,9 +53,9 @@ trait WebDav {
/** /**
* @return string * @return string
*/ */
public function getFilesPath() { public function getFilesPath($user) {
if ($this->davPath === 'remote.php/dav') { if ($this->davPath === "remote.php/dav") {
$basePath = '/files/' . $this->currentUser . '/'; $basePath = '/files/' . $user . '/';
} else { } else {
$basePath = '/'; $basePath = '/';
} }
...@@ -262,12 +262,13 @@ trait WebDav { ...@@ -262,12 +262,13 @@ trait WebDav {
/** /**
* @Then /^as "([^"]*)" the (file|folder|entry) "([^"]*)" does not exist$/ * @Then /^as "([^"]*)" the (file|folder|entry) "([^"]*)" does not exist$/
* @param string $user * @param string $user
* @param string $entry
* @param string $path * @param string $path
* @param \Behat\Gherkin\Node\TableNode|null $propertiesTable * @param \Behat\Gherkin\Node\TableNode|null $propertiesTable
*/ */
public function asTheFileOrFolderDoesNotExist($user, $entry, $path) { public function asTheFileOrFolderDoesNotExist($user, $entry, $path) {
$client = $this->getSabreClient($user); $client = $this->getSabreClient($user);
$response = $client->request('HEAD', $this->makeSabrePath($path)); $response = $client->request('HEAD', $this->makeSabrePath($user, $path));
if ($response['statusCode'] !== 404) { if ($response['statusCode'] !== 404) {
throw new \Exception($entry . ' "' . $path . '" expected to not exist (status code ' . $response['statusCode'] . ', expected 404)'); throw new \Exception($entry . ' "' . $path . '" expected to not exist (status code ' . $response['statusCode'] . ', expected 404)');
} }
...@@ -278,8 +279,8 @@ trait WebDav { ...@@ -278,8 +279,8 @@ trait WebDav {
/** /**
* @Then /^as "([^"]*)" the (file|folder|entry) "([^"]*)" exists$/ * @Then /^as "([^"]*)" the (file|folder|entry) "([^"]*)" exists$/
* @param string $user * @param string $user
* @param string $entry
* @param string $path * @param string $path
* @param \Behat\Gherkin\Node\TableNode|null $propertiesTable
*/ */
public function asTheFileOrFolderExists($user, $entry, $path) { public function asTheFileOrFolderExists($user, $entry, $path) {
$this->response = $this->listFolder($user, $path, 0); $this->response = $this->listFolder($user, $path, 0);
...@@ -362,13 +363,13 @@ trait WebDav { ...@@ -362,13 +363,13 @@ trait WebDav {
]; ];
} }
$response = $client->propfind($this->makeSabrePath($path), $properties, $folderDepth); $response = $client->propfind($this->makeSabrePath($user, $path), $properties, $folderDepth);
return $response; return $response;
} }
public function makeSabrePath($path) { public function makeSabrePath($user, $path) {
return $this->encodePath($this->davPath . $this->getFilesPath() . ltrim($path, '/')); return $this->encodePath($this->davPath . $this->getFilesPath($user) . ltrim($path, '/'));
} }
public function getSabreClient($user) { public function getSabreClient($user) {
...@@ -474,7 +475,7 @@ trait WebDav { ...@@ -474,7 +475,7 @@ trait WebDav {
*/ */
public function userCreatedAFolder($user, $destination) { public function userCreatedAFolder($user, $destination) {
try { try {
$this->response = $this->makeDavRequest($user, "MKCOL", $this->getFilesPath() . ltrim($destination, $this->getFilesPath()), []); $this->response = $this->makeDavRequest($user, "MKCOL", $this->getFilesPath($user) . ltrim($destination, $this->getFilesPath($user)), []);
} catch (\GuzzleHttp\Exception\ServerException $e) { } catch (\GuzzleHttp\Exception\ServerException $e) {
// 4xx and 5xx responses cause an exception // 4xx and 5xx responses cause an exception
$this->response = $e->getResponse(); $this->response = $e->getResponse();
...@@ -584,7 +585,7 @@ trait WebDav { ...@@ -584,7 +585,7 @@ trait WebDav {
]; ];
} }
$response = $client->proppatch($this->davPath . $this->getFilesPath() . ltrim($path, '/'), $properties, $folderDepth); $response = $client->proppatch($this->davPath . $this->getFilesPath($user) . ltrim($path, '/'), $properties, $folderDepth);
return $response; return $response;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment