Overwriting a file while moving and moving

This commit is contained in:
Viktor Scharf
2022-10-14 11:48:20 +02:00
parent 24807bbac8
commit 07dc73f382
5 changed files with 137 additions and 1 deletions
@@ -1673,6 +1673,38 @@ class SpacesContext implements Context {
$this->copyFilesAndFoldersRequest($user, $fullUrl, $headers);
}
/**
* @When /^user "([^"]*)" overwrites file "([^"]*)" from space "([^"]*)" to "([^"]*)" inside space "([^"]*)" while (copying|moving)\s? using the WebDAV API$/
*
* @param string $user
* @param string $fileSource
* @param string $fromSpaceName
* @param string $fileDestination
* @param string $toSpaceName
* @param string $action
*
* @return void
* @throws GuzzleException
*/
public function userOverwritesFileFromAndToSpaceBetweenSpaces(
string $user,
string $fileSource,
string $fromSpaceName,
string $fileDestination,
string $toSpaceName,
string $action
):void {
$space = $this->getSpaceByName($user, $fromSpaceName);
$headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName);
$headers['Overwrite'] = 'T';
$fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($fileSource, "/");
if ($action === 'copying') {
$this->copyFilesAndFoldersRequest($user, $fullUrl, $headers);
} else {
$this->moveFilesAndFoldersRequest($user, $fullUrl, $headers);
}
}
/**
* @Then /^user "([^"]*)" should not be able to download file "([^"]*)" from space "([^"]*)"$/
*