[tests-only] fix MOVE with another user dav path scenarios (#8460)
* test(api): fix MOVE with another user dav path scenarios * test(api): fix php code style * test(api): fix dav paths * test(api): fix dav paths
This commit is contained in:
@@ -25,6 +25,7 @@ use Behat\Gherkin\Node\TableNode;
|
||||
use Behat\Behat\Context\Context;
|
||||
use TestHelpers\SetupHelper;
|
||||
use \Psr\Http\Message\ResponseInterface;
|
||||
use TestHelpers\WebDavHelper;
|
||||
|
||||
/**
|
||||
* Authentication functions
|
||||
@@ -592,7 +593,13 @@ class AuthContext implements Context {
|
||||
public function userRequestsTheseEndpointsAboutUser(string $user, string $method, string $ofUser, TableNode $table):void {
|
||||
$headers = [];
|
||||
if ($method === 'MOVE' || $method === 'COPY') {
|
||||
$headers['Destination'] = '/path/to/destination';
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
$suffix = "";
|
||||
if ($this->featureContext->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES) {
|
||||
$suffix = $this->featureContext->spacesContext->getSpaceIdByName($user, "Personal") . "/";
|
||||
}
|
||||
$davPath = WebDavHelper::getDavPath($user, $this->featureContext->getDavPathVersion());
|
||||
$headers['Destination'] = "{$baseUrl}/{$davPath}{$suffix}moved";
|
||||
}
|
||||
|
||||
foreach ($table->getHash() as $row) {
|
||||
|
||||
@@ -2048,7 +2048,7 @@ class SpacesContext implements Context {
|
||||
if ($toSpaceName === 'Shares') {
|
||||
$sharesPath = $this->featureContext->getSharesMountPath($user, $fileDestination);
|
||||
$davPath = WebDavHelper::getDavPath($user, $this->featureContext->getDavPathVersion());
|
||||
$headers['Destination'] = $baseUrl . $davPath . $sharesPath;
|
||||
$headers['Destination'] = $baseUrl . "/$davPath" . $sharesPath;
|
||||
} else {
|
||||
$headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName, $url);
|
||||
}
|
||||
|
||||
@@ -5000,7 +5000,7 @@ trait WebDav {
|
||||
$sharesPath = $this->getSharesMountPath($user, $path) . '/?' . $urlParameter;
|
||||
|
||||
$davPath = WebDavHelper::getDavPath($user, $this->getDavPathVersion());
|
||||
$fullUrl = $this->getBaseUrl() . $davPath . $sharesPath;
|
||||
$fullUrl = $this->getBaseUrl() . "/$davPath" . $sharesPath;
|
||||
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
@@ -5027,7 +5027,7 @@ trait WebDav {
|
||||
$sharesPath = $this->getSharesMountPath($user, $destination);
|
||||
|
||||
$davPath = WebDavHelper::getDavPath($user, $this->getDavPathVersion());
|
||||
$fullUrl = $this->getBaseUrl() . $davPath . $sharesPath;
|
||||
$fullUrl = $this->getBaseUrl() . "/$davPath" . $sharesPath;
|
||||
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
@@ -5766,7 +5766,7 @@ trait WebDav {
|
||||
if ($entryNameToSearch !== null) {
|
||||
$entryNameToSearch = \trim($entryNameToSearch, "/");
|
||||
}
|
||||
$spacesBaseUrl = webDavHelper::getDavPath(null, webDavHelper::DAV_VERSION_SPACES);
|
||||
$spacesBaseUrl = "/" . webDavHelper::getDavPath(null, webDavHelper::DAV_VERSION_SPACES);
|
||||
$searchResults = $this->getResponseXml()->xpath("//d:multistatus/d:response");
|
||||
$results = [];
|
||||
foreach ($searchResults as $item) {
|
||||
|
||||
Reference in New Issue
Block a user