test: make remote.php configurable

test: build dav paths

test: fix paths

test: merge method args

test: add issue tags

test: add new expected failure file

test: merge expected-failure files before running tests
This commit is contained in:
Saw-jan
2024-10-21 16:57:58 +05:45
parent 273915506e
commit f86d137f87
100 changed files with 2484 additions and 2329 deletions
+10 -25
View File
@@ -492,8 +492,7 @@ class FeatureContext extends BehatVariablesContext {
$this->alternateAdminPassword = "IHave99LotsOfPriv";
$this->publicLinkSharePassword = "publicPwd:1";
// in case of CI deployment we take the server url from the environment
$testServerUrl = \getenv('TEST_SERVER_URL');
$testServerUrl = OcisHelper::getServerUrl();
if ($testServerUrl !== false) {
$this->baseUrl = \rtrim($testServerUrl, '/');
$this->localBaseUrl = $this->baseUrl;
@@ -808,15 +807,6 @@ class FeatureContext extends BehatVariablesContext {
return \ltrim($this->getBasePath() . "/ocs/v$ocsApiVersion.php", "/");
}
/**
* returns the complete DAV path including the base path e.g. owncloud-core/remote.php/dav
*
* @return string
*/
public function getDAVPathIncludingBasePath(): string {
return \ltrim($this->getBasePath() . "/" . $this->getDavPath(), "/");
}
/**
* returns the base URL but without "http(s)://" in front of it
*
@@ -1339,8 +1329,8 @@ class FeatureContext extends BehatVariablesContext {
*/
public function userSendsHTTPMethodToUrl(string $user, string $verb, string $url): void {
$user = $this->getActualUsername($user);
$url = $this->substituteInLineCodes($url, $user);
$this->setResponse($this->sendingToWithDirectUrl($user, $verb, $url));
$endpoint = $this->substituteInLineCodes($url, $user);
$this->setResponse($this->sendingToWithDirectUrl($user, $verb, $endpoint));
}
/**
@@ -1458,7 +1448,11 @@ class FeatureContext extends BehatVariablesContext {
* @throws GuzzleException
*/
public function sendingToWithDirectUrl(string $user, string $verb, string $url, ?string $body = null, ?string $password = null, ?array $headers = null): ResponseInterface {
$fullUrl = $this->getBaseUrl() . $url;
$url = \ltrim($url, '/');
if (WebdavHelper::isDAVRequest($url)) {
$url = WebdavHelper::withRemotePhp($url);
}
$fullUrl = $this->getBaseUrl() . "/$url";
if ($password === null) {
$password = $this->getPasswordForUser($user);
@@ -1947,8 +1941,6 @@ class FeatureContext extends BehatVariablesContext {
}
}
// TODO do similar for other usernames for e.g. %regularuser% or %test-user-1%
/**
* @param string|null $functionalUsername
*
@@ -2119,7 +2111,8 @@ class FeatureContext extends BehatVariablesContext {
*/
public function getCommentUrlRegExp(): string {
$basePath = \ltrim($this->getBasePath() . "/", "/");
return "/{$basePath}remote.php/dav/comments/files/([0-9]+)";
$commentsPath = WebDAVHelper::getDavPath(WebDavHelper::DAV_VERSION_NEW, null, "comments");
return "/{$basePath}/{$commentsPath}/([0-9]+)";
}
/**
@@ -2226,14 +2219,6 @@ class FeatureContext extends BehatVariablesContext {
],
"parameter" => []
],
[
"code" => "%dav_path%",
"function" => [
$this,
"getDAVPathIncludingBasePath"
],
"parameter" => []
],
[
"code" => "%ocs_path_v1%",
"function" => [