[tests-only] Extend API test coverage for MOVE between spaces using file-id (#8126)
* add issue tags * extend API test coverage for MOVE between spaces using file-id * fix table header * re-arrange scenarios * update expected failure * update expected failure
This commit is contained in:
@@ -1980,16 +1980,19 @@ class SpacesContext implements Context {
|
||||
*/
|
||||
public function userCopiesOrMovesFileWithFileIdFromAndToSpaceBetweenSpaces(string $user, string $actionType, string $sourceFile, string $destinationFile, string $toSpaceName, string $url): void {
|
||||
// split the source when there are sub-folders
|
||||
$sourceFile = explode("/", $sourceFile);
|
||||
$sourceFile = \trim($sourceFile, "/");
|
||||
$sourceFile = \explode("/", $sourceFile);
|
||||
$sourceFile = \end($sourceFile);
|
||||
$destinationFile = \trim($destinationFile, "/");
|
||||
$fileDestination = '';
|
||||
if ($actionType === 'copies' || $actionType === 'moves') {
|
||||
$fileDestination = $this->escapePath(\ltrim($destinationFile, "/")) . '/' . $this->escapePath(\ltrim(end($sourceFile), "/"));
|
||||
$fileDestination = $this->escapePath($destinationFile) . '/' . $this->escapePath($sourceFile);
|
||||
} elseif ($actionType === 'renames') {
|
||||
$fileDestination = $destinationFile;
|
||||
}
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
if ($toSpaceName === 'Shares') {
|
||||
$sharesPath = $this->featureContext->getMountSharesPath($user, $fileDestination);
|
||||
$sharesPath = $this->featureContext->getSharesMountPath($user, $fileDestination);
|
||||
$davPath = WebDavHelper::getDavPath($user, $this->featureContext->getDavPathVersion());
|
||||
$headers['Destination'] = $baseUrl . $davPath . $sharesPath;
|
||||
} else {
|
||||
|
||||
@@ -4946,29 +4946,27 @@ trait WebDav {
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getMountSharesPath(
|
||||
public function getSharesMountPath(
|
||||
string $user,
|
||||
string $path
|
||||
): string {
|
||||
$user = $this->getActualUsername($user);
|
||||
$path = trim($path, "/");
|
||||
$pathArray = explode("/", $path);
|
||||
$sharedFolder = $pathArray[0] === "Shares" ? $pathArray[1] : $pathArray[0];
|
||||
|
||||
$shareMountId = GraphHelper::getShareMountId(
|
||||
$this->getBaseUrl(),
|
||||
$this->getStepLineRef(),
|
||||
$user,
|
||||
$this->getPasswordForUser($user),
|
||||
$pathArray[1]
|
||||
$sharedFolder
|
||||
);
|
||||
|
||||
if (\count($pathArray) > 2) {
|
||||
$pathArray = \array_slice($pathArray, 2);
|
||||
$path = '/' . implode("/", array_map("strval", $pathArray));
|
||||
} else {
|
||||
$path = null;
|
||||
}
|
||||
return $shareMountId . $path;
|
||||
$path = \array_slice($pathArray, array_search($sharedFolder, $pathArray) + 1);
|
||||
$path = \implode("/", $path);
|
||||
|
||||
return "$shareMountId/$path";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4997,7 +4995,7 @@ trait WebDav {
|
||||
} else {
|
||||
$urlParameter = null;
|
||||
}
|
||||
$sharesPath = $this->getMountSharesPath($user, $path) . '/?' . $urlParameter;
|
||||
$sharesPath = $this->getSharesMountPath($user, $path) . '/?' . $urlParameter;
|
||||
|
||||
$davPath = WebDavHelper::getDavPath($user, $this->getDavPathVersion());
|
||||
$fullUrl = $this->getBaseUrl() . $davPath . $sharesPath;
|
||||
@@ -5024,7 +5022,7 @@ trait WebDav {
|
||||
string $destination,
|
||||
?string $content = null
|
||||
): ResponseInterface {
|
||||
$sharesPath = $this->getMountSharesPath($user, $destination);
|
||||
$sharesPath = $this->getSharesMountPath($user, $destination);
|
||||
|
||||
$davPath = WebDavHelper::getDavPath($user, $this->getDavPathVersion());
|
||||
$fullUrl = $this->getBaseUrl() . $davPath . $sharesPath;
|
||||
|
||||
Reference in New Issue
Block a user