Merge pull request #10044 from owncloud/tests-report-request

[tests-only][full-ci] refactor userSearchesUsingWebDavAPI function to update davPath for new and spaces dav versions
This commit is contained in:
Sawjan Gurung
2024-09-17 17:30:58 +05:45
committed by GitHub
+16 -7
View File
@@ -25,6 +25,7 @@ use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Gherkin\Node\TableNode; use Behat\Gherkin\Node\TableNode;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use TestHelpers\WebDavHelper; use TestHelpers\WebDavHelper;
use TestHelpers\HttpRequestHelper;
require_once 'bootstrap.php'; require_once 'bootstrap.php';
@@ -102,16 +103,24 @@ class SearchContext implements Context {
$body .= " </a:prop>"; $body .= " </a:prop>";
} }
$body .= " </oc:search-files>"; $body .= " </oc:search-files>";
$response = WebDavHelper::makeDavRequest( $davPathVersionToUse = $this->featureContext->getDavPathVersion();
$baseUrl, $davPath = WebDavHelper::getDavPath($doDavRequestAsUser ?? $user, $davPathVersionToUse, 'files');
if ($davPathVersionToUse == WebDavHelper::DAV_VERSION_NEW) {
// Removes the last component('username' in this case) from the WebDAV path by going up one level in the directory structure.
// e.g. remote.php/dav/files/Alice ==> remote.php/dav/files/
$davPath = \dirname($davPath, 1);
}
$fullUrl = WebDavHelper::sanitizeUrl("$baseUrl/$davPath");
$response = HttpRequestHelper::sendRequest(
$fullUrl,
$this->featureContext->getStepLineRef(),
'REPORT',
$user, $user,
$password, $password,
"REPORT",
"/",
null, null,
$this->featureContext->getStepLineRef(), $body
$body,
$this->featureContext->getDavPathVersion()
); );
$this->featureContext->setResponse($response); $this->featureContext->setResponse($response);
} }