mirror of
https://github.com/owncloud/ocis
synced 2026-04-25 17:25:21 +02:00
refactor: add trailing-comma in method args and params
Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
This commit is contained in:
@@ -27,7 +27,9 @@ $config->setFinder($finder)
|
||||
'no_unused_imports' => true,
|
||||
'array_indentation' => true,
|
||||
'method_chaining_indentation' => true,
|
||||
'trailing_comma_in_multiline' => true,
|
||||
'trailing_comma_in_multiline' => [
|
||||
'elements' => ['arrays', 'arguments', 'parameters'],
|
||||
],
|
||||
'no_useless_else' => true,
|
||||
'single_line_comment_spacing' => true,
|
||||
'no_trailing_whitespace_in_comment' => true,
|
||||
|
||||
@@ -41,7 +41,7 @@ class WebDav extends Assert {
|
||||
?string $element,
|
||||
?string $expectedValue,
|
||||
?array $responseXmlArray,
|
||||
?string $extraErrorText = ''
|
||||
?string $extraErrorText = '',
|
||||
): void {
|
||||
if ($extraErrorText !== '') {
|
||||
$extraErrorText = $extraErrorText . " ";
|
||||
@@ -49,7 +49,7 @@ class WebDav extends Assert {
|
||||
self::assertArrayHasKey(
|
||||
'value',
|
||||
$responseXmlArray,
|
||||
$extraErrorText . "responseXml does not have key 'value'"
|
||||
$extraErrorText . "responseXml does not have key 'value'",
|
||||
);
|
||||
if ($element === "exception") {
|
||||
$result = $responseXmlArray['value'][0]['value'];
|
||||
@@ -59,14 +59,14 @@ class WebDav extends Assert {
|
||||
$result = $responseXmlArray['value'][3]['value'];
|
||||
} else {
|
||||
self::fail(
|
||||
__METHOD__ . " element must be one of exception, response or reason. But '$element' was passed in."
|
||||
__METHOD__ . " element must be one of exception, response or reason. But '$element' was passed in.",
|
||||
);
|
||||
}
|
||||
|
||||
self::assertEquals(
|
||||
$expectedValue,
|
||||
$result,
|
||||
__METHOD__ . " " . $extraErrorText . "Expected '$expectedValue' in element $element got '$result'"
|
||||
__METHOD__ . " " . $extraErrorText . "Expected '$expectedValue' in element $element got '$result'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -79,15 +79,15 @@ class WebDav extends Assert {
|
||||
*/
|
||||
public static function assertResponseContainsShareTypes(
|
||||
SimpleXMLElement $responseXmlObject,
|
||||
?array $expectedShareTypes
|
||||
?array $expectedShareTypes,
|
||||
): void {
|
||||
foreach ($expectedShareTypes as $row) {
|
||||
$xmlPart = $responseXmlObject->xpath(
|
||||
"//d:prop/oc:share-types/oc:share-type[.=" . $row[0] . "]"
|
||||
"//d:prop/oc:share-types/oc:share-type[.=" . $row[0] . "]",
|
||||
);
|
||||
self::assertNotEmpty(
|
||||
$xmlPart,
|
||||
"cannot find share-type '" . $row[0] . "'"
|
||||
"cannot find share-type '" . $row[0] . "'",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class AuthAppHelper {
|
||||
public static function listAllAppAuthTokensForUser(
|
||||
string $baseUrl,
|
||||
string $user,
|
||||
string $password
|
||||
string $password,
|
||||
): ResponseInterface {
|
||||
$url = $baseUrl . self::getAuthAppEndpoint();
|
||||
return HttpRequestHelper::sendRequest(
|
||||
@@ -92,7 +92,7 @@ class AuthAppHelper {
|
||||
string $baseUrl,
|
||||
string $user,
|
||||
string $password,
|
||||
string $token
|
||||
string $token,
|
||||
): ResponseInterface {
|
||||
$url = $baseUrl . self::getAuthAppEndpoint() . "?token=$token";
|
||||
return HttpRequestHelper::sendRequest(
|
||||
|
||||
@@ -41,7 +41,7 @@ class BehatHelper {
|
||||
public static function getContext(
|
||||
ScenarioScope $scope,
|
||||
InitializedContextEnvironment $environment,
|
||||
string $class
|
||||
string $class,
|
||||
): Context {
|
||||
try {
|
||||
return $environment->getContext($class);
|
||||
|
||||
@@ -57,7 +57,7 @@ class CollaborationHelper {
|
||||
$url,
|
||||
$username,
|
||||
$password,
|
||||
['Content-Type' => 'application/json']
|
||||
['Content-Type' => 'application/json'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -78,14 +78,14 @@ class CollaborationHelper {
|
||||
string $password,
|
||||
string $parentContainerId,
|
||||
string $file,
|
||||
?array $headers = null
|
||||
?array $headers = null,
|
||||
): ResponseInterface {
|
||||
$url = $baseUrl . "/app/new?parent_container_id=$parentContainerId&filename=$file";
|
||||
return HttpRequestHelper::post(
|
||||
$url,
|
||||
$user,
|
||||
$password,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class EmailHelper {
|
||||
self::getEmailAPIUrl("messages"),
|
||||
null,
|
||||
null,
|
||||
['Content-Type' => 'application/json']
|
||||
['Content-Type' => 'application/json'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class EmailHelper {
|
||||
self::getEmailAPIUrl("message/$id") . "?query=$query",
|
||||
null,
|
||||
null,
|
||||
['Content-Type' => 'application/json']
|
||||
['Content-Type' => 'application/json'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ class EmailHelper {
|
||||
$url,
|
||||
null,
|
||||
null,
|
||||
['Content-Type' => 'application/json']
|
||||
['Content-Type' => 'application/json'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ class EmailHelper {
|
||||
self::getEmailAPIUrl("messages"),
|
||||
null,
|
||||
null,
|
||||
['Content-Type' => 'application/json']
|
||||
['Content-Type' => 'application/json'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -116,7 +116,7 @@ class HttpRequestHelper {
|
||||
?CookieJar $cookies = null,
|
||||
bool $stream = false,
|
||||
?int $timeout = 0,
|
||||
?Client $client = null
|
||||
?Client $client = null,
|
||||
): ResponseInterface {
|
||||
if ($client === null) {
|
||||
$client = self::createClient(
|
||||
@@ -125,7 +125,7 @@ class HttpRequestHelper {
|
||||
$config,
|
||||
$cookies,
|
||||
$stream,
|
||||
$timeout
|
||||
$timeout,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class HttpRequestHelper {
|
||||
$url,
|
||||
$method,
|
||||
$headers,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
|
||||
if ((\getenv('DEBUG_ACCEPTANCE_REQUESTS') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) {
|
||||
@@ -216,7 +216,7 @@ class HttpRequestHelper {
|
||||
bool $stream = false,
|
||||
?int $timeout = 0,
|
||||
?Client $client = null,
|
||||
?bool $isGivenStep = false
|
||||
?bool $isGivenStep = false,
|
||||
): ResponseInterface {
|
||||
if ((\getenv('DEBUG_ACCEPTANCE_RESPONSES') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) {
|
||||
$debugResponses = true;
|
||||
@@ -239,7 +239,7 @@ class HttpRequestHelper {
|
||||
$cookies,
|
||||
$stream,
|
||||
$timeout,
|
||||
$client
|
||||
$client,
|
||||
);
|
||||
|
||||
if ($response->getStatusCode() >= 400
|
||||
@@ -354,7 +354,7 @@ class HttpRequestHelper {
|
||||
*/
|
||||
public static function sendBatchRequest(
|
||||
?array $requests,
|
||||
?Client $client
|
||||
?Client $client,
|
||||
): array {
|
||||
return Pool::batch($client, $requests);
|
||||
}
|
||||
@@ -379,7 +379,7 @@ class HttpRequestHelper {
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false,
|
||||
?int $timeout = 0
|
||||
?int $timeout = 0,
|
||||
): Client {
|
||||
$options = [];
|
||||
if ($user !== null) {
|
||||
@@ -415,7 +415,7 @@ class HttpRequestHelper {
|
||||
?string $url,
|
||||
?string $method = 'GET',
|
||||
?array $headers = null,
|
||||
$body = null
|
||||
$body = null,
|
||||
): RequestInterface {
|
||||
if ($headers === null) {
|
||||
$headers = [];
|
||||
@@ -434,7 +434,7 @@ class HttpRequestHelper {
|
||||
$method,
|
||||
$url,
|
||||
$headers,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
HttpLogger::logRequest($request);
|
||||
return $request;
|
||||
@@ -464,7 +464,7 @@ class HttpRequestHelper {
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false
|
||||
?bool $stream = false,
|
||||
): ResponseInterface {
|
||||
return self::sendRequest(
|
||||
$url,
|
||||
@@ -475,7 +475,7 @@ class HttpRequestHelper {
|
||||
$body,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream
|
||||
$stream,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ class HttpRequestHelper {
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false
|
||||
?bool $stream = false,
|
||||
): ResponseInterface {
|
||||
return self::sendRequest(
|
||||
$url,
|
||||
@@ -514,7 +514,7 @@ class HttpRequestHelper {
|
||||
$body,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream
|
||||
$stream,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ class HttpRequestHelper {
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false
|
||||
?bool $stream = false,
|
||||
): ResponseInterface {
|
||||
return self::sendRequest(
|
||||
$url,
|
||||
@@ -553,7 +553,7 @@ class HttpRequestHelper {
|
||||
$body,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream
|
||||
$stream,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ class HttpRequestHelper {
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false
|
||||
?bool $stream = false,
|
||||
): ResponseInterface {
|
||||
return self::sendRequest(
|
||||
$url,
|
||||
@@ -593,7 +593,7 @@ class HttpRequestHelper {
|
||||
$body,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream
|
||||
$stream,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -619,15 +619,15 @@ class HttpRequestHelper {
|
||||
$responseXmlObject = new SimpleXMLElement($contents);
|
||||
$responseXmlObject->registerXPathNamespace(
|
||||
'ocs',
|
||||
'http://open-collaboration-services.org/ns'
|
||||
'http://open-collaboration-services.org/ns',
|
||||
);
|
||||
$responseXmlObject->registerXPathNamespace(
|
||||
'oc',
|
||||
'http://owncloud.org/ns'
|
||||
'http://owncloud.org/ns',
|
||||
);
|
||||
$responseXmlObject->registerXPathNamespace(
|
||||
'd',
|
||||
'DAV:'
|
||||
'DAV:',
|
||||
);
|
||||
return $responseXmlObject;
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -42,14 +42,14 @@ class OcisConfigHelper {
|
||||
public static function sendRequest(
|
||||
string $url,
|
||||
string $method,
|
||||
?string $body = ""
|
||||
?string $body = "",
|
||||
): ResponseInterface {
|
||||
$client = HttpRequestHelper::createClient();
|
||||
$request = new Request(
|
||||
$method,
|
||||
$url,
|
||||
[],
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
|
||||
try {
|
||||
@@ -58,7 +58,7 @@ class OcisConfigHelper {
|
||||
throw new \Error(
|
||||
"Cannot connect to the ociswrapper at the moment,"
|
||||
. "make sure that ociswrapper is running before proceeding with the test run.\n"
|
||||
. $e->getMessage()
|
||||
. $e->getMessage(),
|
||||
);
|
||||
} catch (GuzzleException $ex) {
|
||||
$response = $ex->getResponse();
|
||||
|
||||
@@ -115,7 +115,7 @@ class OcisHelper {
|
||||
if (!\in_array($storageDriver, self::STORAGE_DRIVERS)) {
|
||||
throw new Exception(
|
||||
"Invalid storage driver. " .
|
||||
"STORAGE_DRIVER must be '" . \join(", ", self::STORAGE_DRIVERS) . "'"
|
||||
"STORAGE_DRIVER must be '" . \join(", ", self::STORAGE_DRIVERS) . "'",
|
||||
);
|
||||
}
|
||||
return $storageDriver;
|
||||
@@ -148,7 +148,7 @@ class OcisHelper {
|
||||
$deleteCmd = \str_replace(
|
||||
"%s",
|
||||
$user[0] . '/' . $user,
|
||||
$deleteCmd
|
||||
$deleteCmd,
|
||||
);
|
||||
} else {
|
||||
$deleteCmd = \sprintf($deleteCmd, $user);
|
||||
@@ -308,7 +308,7 @@ class OcisHelper {
|
||||
HttpRequestHelper::get(
|
||||
$baseUrl . "/ocs/v2.php/apps/notifications/api/v1/notifications",
|
||||
$user,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class OcmHelper {
|
||||
string $user,
|
||||
string $password,
|
||||
?string $email = null,
|
||||
?string $description = null
|
||||
?string $description = null,
|
||||
): ResponseInterface {
|
||||
$body = [
|
||||
"description" => $description,
|
||||
@@ -80,7 +80,7 @@ class OcmHelper {
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders(),
|
||||
\json_encode($body)
|
||||
\json_encode($body),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ class OcmHelper {
|
||||
string $user,
|
||||
string $password,
|
||||
string $token,
|
||||
string $providerDomain
|
||||
string $providerDomain,
|
||||
): ResponseInterface {
|
||||
$body = [
|
||||
"token" => $token,
|
||||
@@ -111,7 +111,7 @@ class OcmHelper {
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders(),
|
||||
\json_encode($body)
|
||||
\json_encode($body),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -126,14 +126,14 @@ class OcmHelper {
|
||||
public static function findAcceptedUsers(
|
||||
string $baseUrl,
|
||||
string $user,
|
||||
string $password
|
||||
string $password,
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'find-accepted-users');
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
self::getRequestHeaders(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,14 +148,14 @@ class OcmHelper {
|
||||
public static function listInvite(
|
||||
string $baseUrl,
|
||||
string $user,
|
||||
string $password
|
||||
string $password,
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'list-invite');
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
self::getRequestHeaders(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class OcmHelper {
|
||||
string $user,
|
||||
string $password,
|
||||
string $userId,
|
||||
string $idp
|
||||
string $idp,
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'delete-accepted-user');
|
||||
$body = [
|
||||
@@ -186,7 +186,7 @@ class OcmHelper {
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders(),
|
||||
\json_encode($body)
|
||||
\json_encode($body),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class OcsApiHelper {
|
||||
?string $path,
|
||||
$body = [],
|
||||
?int $ocsApiVersion = 2,
|
||||
?array $headers = []
|
||||
?array $headers = [],
|
||||
): ResponseInterface {
|
||||
$fullUrl = $baseUrl;
|
||||
if (\substr($fullUrl, -1) !== '/') {
|
||||
@@ -81,7 +81,7 @@ class OcsApiHelper {
|
||||
?string $path,
|
||||
$body = [],
|
||||
?int $ocsApiVersion = 2,
|
||||
?array $headers = []
|
||||
?array $headers = [],
|
||||
): RequestInterface {
|
||||
$fullUrl = $baseUrl;
|
||||
if (\substr($fullUrl, -1) !== '/') {
|
||||
@@ -92,7 +92,7 @@ class OcsApiHelper {
|
||||
$fullUrl,
|
||||
$method,
|
||||
$headers,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class SettingsHelper {
|
||||
string $baseUrl,
|
||||
string $user,
|
||||
string $password,
|
||||
array $headers = []
|
||||
array $headers = [],
|
||||
): ResponseInterface {
|
||||
$fullUrl = self::buildFullUrl($baseUrl, "bundles-list");
|
||||
return HttpRequestHelper::post(
|
||||
@@ -102,7 +102,7 @@ class SettingsHelper {
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
"{}"
|
||||
"{}",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ class SettingsHelper {
|
||||
string $baseUrl,
|
||||
string $user,
|
||||
string $password,
|
||||
array $headers = []
|
||||
array $headers = [],
|
||||
): ResponseInterface {
|
||||
$fullUrl = self::buildFullUrl($baseUrl, "roles-list");
|
||||
return HttpRequestHelper::post(
|
||||
@@ -158,7 +158,7 @@ class SettingsHelper {
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
"{}"
|
||||
"{}",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class SettingsHelper {
|
||||
string $password,
|
||||
string $assigneeId,
|
||||
string $roleId,
|
||||
array $headers = []
|
||||
array $headers = [],
|
||||
): ResponseInterface {
|
||||
$fullUrl = self::buildFullUrl($baseUrl, "assignments-add");
|
||||
$body = json_encode(["account_uuid" => $assigneeId, "role_id" => $roleId], JSON_THROW_ON_ERROR);
|
||||
@@ -190,7 +190,7 @@ class SettingsHelper {
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ class SettingsHelper {
|
||||
string $user,
|
||||
string $password,
|
||||
string $userId,
|
||||
array $headers = []
|
||||
array $headers = [],
|
||||
): ResponseInterface {
|
||||
$fullUrl = self::buildFullUrl($baseUrl, "assignments-list");
|
||||
$body = json_encode(["account_uuid" => $userId], JSON_THROW_ON_ERROR);
|
||||
@@ -220,7 +220,7 @@ class SettingsHelper {
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ class SettingsHelper {
|
||||
string $baseUrl,
|
||||
string $user,
|
||||
string $password,
|
||||
array $headers = []
|
||||
array $headers = [],
|
||||
): ResponseInterface {
|
||||
$fullUrl = self::buildFullUrl($baseUrl, "values-list");
|
||||
$body = json_encode(["account_uuid" => "me"], JSON_THROW_ON_ERROR);
|
||||
@@ -248,7 +248,7 @@ class SettingsHelper {
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ class SettingsHelper {
|
||||
string $user,
|
||||
string $password,
|
||||
string $body,
|
||||
array $headers = []
|
||||
array $headers = [],
|
||||
): ResponseInterface {
|
||||
$fullUrl = self::buildFullUrl($baseUrl, "values-save");
|
||||
return HttpRequestHelper::post(
|
||||
@@ -346,7 +346,7 @@ class SettingsHelper {
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -373,14 +373,14 @@ class SettingsHelper {
|
||||
"accountUuid" => "me",
|
||||
"settingId" => $settingId,
|
||||
],
|
||||
JSON_THROW_ON_ERROR
|
||||
JSON_THROW_ON_ERROR,
|
||||
);
|
||||
return HttpRequestHelper::post(
|
||||
$fullUrl,
|
||||
$user,
|
||||
$password,
|
||||
[],
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,13 +59,13 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
public static function init(
|
||||
?string $adminUsername,
|
||||
?string $adminPassword,
|
||||
?string $baseUrl
|
||||
?string $baseUrl,
|
||||
): void {
|
||||
foreach (\func_get_args() as $variableToCheck) {
|
||||
if (!\is_string($variableToCheck)) {
|
||||
throw new \InvalidArgumentException(
|
||||
"mandatory argument missing or wrong type ($variableToCheck => "
|
||||
. \gettype($variableToCheck) . ")"
|
||||
. \gettype($variableToCheck) . ")",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
);
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not get sysinfo " . $result->getReasonPhrase()
|
||||
"could not get sysinfo " . $result->getReasonPhrase(),
|
||||
);
|
||||
}
|
||||
return HttpRequestHelper::getResponseXml($result, __METHOD__)->data;
|
||||
@@ -140,7 +140,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
&& $adminUsername === null
|
||||
) {
|
||||
throw new Exception(
|
||||
"$callerName called without adminUsername - pass the username or call SetupHelper::init"
|
||||
"$callerName called without adminUsername - pass the username or call SetupHelper::init",
|
||||
);
|
||||
}
|
||||
if ($adminUsername === null) {
|
||||
@@ -161,7 +161,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
&& $adminPassword === null
|
||||
) {
|
||||
throw new Exception(
|
||||
"$callerName called without adminPassword - pass the password or call SetupHelper::init"
|
||||
"$callerName called without adminPassword - pass the password or call SetupHelper::init",
|
||||
);
|
||||
}
|
||||
if ($adminPassword === null) {
|
||||
@@ -182,7 +182,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
&& $baseUrl === null
|
||||
) {
|
||||
throw new Exception(
|
||||
"$callerName called without baseUrl - pass the baseUrl or call SetupHelper::init"
|
||||
"$callerName called without baseUrl - pass the baseUrl or call SetupHelper::init",
|
||||
);
|
||||
}
|
||||
if ($baseUrl === null) {
|
||||
@@ -206,7 +206,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
?string $dirPathFromServerRoot,
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
?string $adminPassword = null,
|
||||
): void {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "mkDirOnServer");
|
||||
$adminUsername = self::checkAdminUsername($adminUsername, "mkDirOnServer");
|
||||
@@ -217,12 +217,12 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
$adminPassword,
|
||||
"POST",
|
||||
"/apps/testing/api/v1/dir",
|
||||
['dir' => $dirPathFromServerRoot]
|
||||
['dir' => $dirPathFromServerRoot],
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not create directory $dirPathFromServerRoot " . $result->getReasonPhrase()
|
||||
"could not create directory $dirPathFromServerRoot " . $result->getReasonPhrase(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -242,7 +242,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
?string $dirPathFromServerRoot,
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
?string $adminPassword = null,
|
||||
): void {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "rmDirOnServer");
|
||||
$adminUsername = self::checkAdminUsername($adminUsername, "rmDirOnServer");
|
||||
@@ -253,12 +253,12 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
$adminPassword,
|
||||
"DELETE",
|
||||
"/apps/testing/api/v1/dir",
|
||||
['dir' => $dirPathFromServerRoot]
|
||||
['dir' => $dirPathFromServerRoot],
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not delete directory $dirPathFromServerRoot " . $result->getReasonPhrase()
|
||||
"could not delete directory $dirPathFromServerRoot " . $result->getReasonPhrase(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
?string $content,
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
?string $adminPassword = null,
|
||||
): void {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "createFileOnServer");
|
||||
$adminUsername = self::checkAdminUsername($adminUsername, "createFileOnServer");
|
||||
@@ -294,12 +294,12 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
[
|
||||
'file' => $filePathFromServerRoot,
|
||||
'content' => $content,
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not create file $filePathFromServerRoot " . $result->getReasonPhrase()
|
||||
"could not create file $filePathFromServerRoot " . $result->getReasonPhrase(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
?string $filePathFromServerRoot,
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
?string $adminPassword = null,
|
||||
): void {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "deleteFileOnServer");
|
||||
$adminUsername = self::checkAdminUsername($adminUsername, "deleteFileOnServer");
|
||||
@@ -332,12 +332,12 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
"/apps/testing/api/v1/file",
|
||||
[
|
||||
'file' => $filePathFromServerRoot,
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not delete file $filePathFromServerRoot " . $result->getReasonPhrase()
|
||||
"could not delete file $filePathFromServerRoot " . $result->getReasonPhrase(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -356,16 +356,16 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
?string $fileInCore,
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
?string $adminPassword = null,
|
||||
): string {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "readFile");
|
||||
$adminUsername = self::checkAdminUsername(
|
||||
$adminUsername,
|
||||
"readFile"
|
||||
"readFile",
|
||||
);
|
||||
$adminPassword = self::checkAdminPassword(
|
||||
$adminPassword,
|
||||
"readFile"
|
||||
"readFile",
|
||||
);
|
||||
|
||||
$response = OcsApiHelper::sendRequest(
|
||||
@@ -378,7 +378,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
self::assertSame(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to read the file $fileInCore"
|
||||
"Failed to read the file $fileInCore",
|
||||
);
|
||||
$localContent = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||
$localContent = (string)$localContent->data->element->contentUrlEncoded;
|
||||
|
||||
@@ -106,14 +106,14 @@ class SharingHelper {
|
||||
?string $space_ref = null,
|
||||
int $ocsApiVersion = 1,
|
||||
int $sharingApiVersion = 1,
|
||||
string $sharingApp = 'files_sharing'
|
||||
string $sharingApp = 'files_sharing',
|
||||
): ResponseInterface {
|
||||
$fd = [];
|
||||
foreach ([$path, $baseUrl, $user, $password] as $variableToCheck) {
|
||||
if (!\is_string($variableToCheck)) {
|
||||
throw new InvalidArgumentException(
|
||||
"mandatory argument missing or wrong type ($variableToCheck => "
|
||||
. \gettype($variableToCheck) . ")"
|
||||
. \gettype($variableToCheck) . ")",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -127,12 +127,12 @@ class SharingHelper {
|
||||
|
||||
if (!\in_array($ocsApiVersion, [1, 2], true)) {
|
||||
throw new InvalidArgumentException(
|
||||
"invalid ocsApiVersion ($ocsApiVersion)"
|
||||
"invalid ocsApiVersion ($ocsApiVersion)",
|
||||
);
|
||||
}
|
||||
if (!\in_array($sharingApiVersion, [1, 2], true)) {
|
||||
throw new InvalidArgumentException(
|
||||
"invalid sharingApiVersion ($sharingApiVersion)"
|
||||
"invalid sharingApiVersion ($sharingApiVersion)",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class SharingHelper {
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$fd
|
||||
$fd,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -206,13 +206,13 @@ class SharingHelper {
|
||||
$permissionSum += $permission;
|
||||
} else {
|
||||
throw new InvalidArgumentException(
|
||||
"invalid permission type ($permission)"
|
||||
"invalid permission type ($permission)",
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($permissionSum < 0 || $permissionSum > 31) {
|
||||
throw new InvalidArgumentException(
|
||||
"invalid permission total ($permissionSum)"
|
||||
"invalid permission total ($permissionSum)",
|
||||
);
|
||||
}
|
||||
return $permissionSum;
|
||||
@@ -239,7 +239,7 @@ class SharingHelper {
|
||||
return self::SHARE_TYPES[$key];
|
||||
}
|
||||
throw new InvalidArgumentException(
|
||||
"invalid share type ($shareType)"
|
||||
"invalid share type ($shareType)",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ class SharingHelper {
|
||||
*/
|
||||
public static function getLastShareIdFromResponse(
|
||||
SimpleXMLElement $responseXmlObject,
|
||||
string $errorMessage = "cannot find share id in response"
|
||||
string $errorMessage = "cannot find share id in response",
|
||||
): string {
|
||||
$xmlPart = $responseXmlObject->xpath("//data/element[last()]/id");
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class TusClient extends Client {
|
||||
[
|
||||
'body' => $data,
|
||||
'headers' => $headers,
|
||||
]
|
||||
],
|
||||
);
|
||||
} catch (ClientException $e) {
|
||||
$response = $e->getResponse();
|
||||
@@ -84,9 +84,9 @@ class TusClient extends Client {
|
||||
[
|
||||
'location' => $uploadLocation,
|
||||
'expires_at' => Carbon::now()->addSeconds(
|
||||
$this->getCache()->getTtl()
|
||||
$this->getCache()->getTtl(),
|
||||
)->format($this->getCache()::RFC_7231),
|
||||
]
|
||||
],
|
||||
);
|
||||
}
|
||||
return $response;
|
||||
@@ -130,7 +130,7 @@ class TusClient extends Client {
|
||||
[
|
||||
'body' => $data,
|
||||
'headers' => $headers,
|
||||
]
|
||||
],
|
||||
);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class UploadHelper extends Assert {
|
||||
null,
|
||||
[],
|
||||
null,
|
||||
$isGivenStep
|
||||
$isGivenStep,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class UploadHelper extends Assert {
|
||||
null,
|
||||
[],
|
||||
null,
|
||||
$isGivenStep
|
||||
$isGivenStep,
|
||||
);
|
||||
if ($result->getStatusCode() >= 400) {
|
||||
return $result;
|
||||
@@ -173,7 +173,7 @@ class UploadHelper extends Assert {
|
||||
return $size;
|
||||
default:
|
||||
throw new \InvalidArgumentException(
|
||||
"Invalid size unit '$sizeUnit' in '$sizeString'. Use GB, MB, KB or no unit for bytes."
|
||||
"Invalid size unit '$sizeUnit' in '$sizeString'. Use GB, MB, KB or no unit for bytes.",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -199,11 +199,11 @@ class UploadHelper extends Assert {
|
||||
\fclose($file);
|
||||
self::assertEquals(
|
||||
1,
|
||||
\file_exists($name)
|
||||
\file_exists($name),
|
||||
);
|
||||
self::assertEquals(
|
||||
$size,
|
||||
\filesize($name)
|
||||
\filesize($name),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ class UploadHelper extends Assert {
|
||||
\fclose($file);
|
||||
self::assertEquals(
|
||||
1,
|
||||
\file_exists($name)
|
||||
\file_exists($name),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class UserHelper {
|
||||
string $value,
|
||||
string $adminUser,
|
||||
string $adminPassword,
|
||||
?int $ocsApiVersion = 2
|
||||
?int $ocsApiVersion = 2,
|
||||
): ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
@@ -62,7 +62,7 @@ class UserHelper {
|
||||
"PUT",
|
||||
"/cloud/users/" . $user,
|
||||
["key" => $key, "value" => $value],
|
||||
$ocsApiVersion
|
||||
$ocsApiVersion,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -84,12 +84,12 @@ class UserHelper {
|
||||
?array $editData,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?int $ocsApiVersion = 2
|
||||
?int $ocsApiVersion = 2,
|
||||
): array {
|
||||
$requests = [];
|
||||
$client = HttpRequestHelper::createClient(
|
||||
$adminUser,
|
||||
$adminPassword
|
||||
$adminPassword,
|
||||
);
|
||||
|
||||
foreach ($editData as $data) {
|
||||
@@ -100,7 +100,7 @@ class UserHelper {
|
||||
$baseUrl,
|
||||
'PUT',
|
||||
$path,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
// Send the array of requests at once in parallel.
|
||||
@@ -111,7 +111,7 @@ class UserHelper {
|
||||
$httpStatusCode = $e->getResponse()->getStatusCode();
|
||||
$reasonPhrase = $e->getResponse()->getReasonPhrase();
|
||||
throw new Exception(
|
||||
"Unexpected failure when editing a user: HTTP status $httpStatusCode HTTP reason $reasonPhrase"
|
||||
"Unexpected failure when editing a user: HTTP status $httpStatusCode HTTP reason $reasonPhrase",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class UserHelper {
|
||||
?string $userName,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?int $ocsApiVersion = 2
|
||||
?int $ocsApiVersion = 2,
|
||||
): ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
@@ -143,7 +143,7 @@ class UserHelper {
|
||||
"GET",
|
||||
"/cloud/users/" . $userName,
|
||||
[],
|
||||
$ocsApiVersion
|
||||
$ocsApiVersion,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ class UserHelper {
|
||||
?string $userName,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?int $ocsApiVersion = 2
|
||||
?int $ocsApiVersion = 2,
|
||||
): ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
@@ -172,7 +172,7 @@ class UserHelper {
|
||||
"DELETE",
|
||||
"/cloud/users/" . $userName,
|
||||
[],
|
||||
$ocsApiVersion
|
||||
$ocsApiVersion,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ class UserHelper {
|
||||
?string $group,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?int $ocsApiVersion = 2
|
||||
?int $ocsApiVersion = 2,
|
||||
): ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
@@ -203,7 +203,7 @@ class UserHelper {
|
||||
"POST",
|
||||
"/cloud/users/" . $user . "/groups",
|
||||
['groupid' => $group],
|
||||
$ocsApiVersion
|
||||
$ocsApiVersion,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ class UserHelper {
|
||||
?string $group,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?int $ocsApiVersion = 2
|
||||
?int $ocsApiVersion = 2,
|
||||
): ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
@@ -234,7 +234,7 @@ class UserHelper {
|
||||
"DELETE",
|
||||
"/cloud/users/" . $user . "/groups",
|
||||
['groupid' => $group],
|
||||
$ocsApiVersion
|
||||
$ocsApiVersion,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ class UserHelper {
|
||||
?string $baseUrl,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $search = ""
|
||||
?string $search = "",
|
||||
): ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
@@ -277,13 +277,13 @@ class UserHelper {
|
||||
?string $baseUrl,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $search = ""
|
||||
?string $search = "",
|
||||
): array {
|
||||
$result = self::getGroups(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
$search
|
||||
$search,
|
||||
);
|
||||
$groups = HttpRequestHelper::getResponseXml($result, __METHOD__)->xpath(".//groups")[0];
|
||||
$return = [];
|
||||
|
||||
@@ -85,7 +85,7 @@ class WebDavHelper {
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function removeSpaceIdReferenceForUser(
|
||||
?string $user
|
||||
?string $user,
|
||||
): void {
|
||||
if (\array_key_exists($user, self::$spacesIdRef)) {
|
||||
unset(self::$spacesIdRef[$user]);
|
||||
@@ -123,7 +123,7 @@ class WebDavHelper {
|
||||
?string $password,
|
||||
?string $path,
|
||||
?string $spaceId = null,
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW,
|
||||
): string {
|
||||
$body
|
||||
= '<?xml version="1.0"?>
|
||||
@@ -141,12 +141,12 @@ class WebDavHelper {
|
||||
null,
|
||||
$spaceId,
|
||||
$body,
|
||||
$davPathVersionToUse
|
||||
$davPathVersionToUse,
|
||||
);
|
||||
\preg_match(
|
||||
'/\<oc:fileid\>([^\<]*)\<\/oc:fileid\>/',
|
||||
$response->getBody()->getContents(),
|
||||
$matches
|
||||
$matches,
|
||||
);
|
||||
|
||||
if (!isset($matches[1])) {
|
||||
@@ -239,7 +239,7 @@ class WebDavHelper {
|
||||
?string $type = "files",
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW,
|
||||
?string $doDavRequestAsUser = null,
|
||||
?array $headers = []
|
||||
?array $headers = [],
|
||||
): ResponseInterface {
|
||||
$body = self::getBodyForPropfind($properties);
|
||||
$folderDepth = (string) $folderDepth;
|
||||
@@ -267,7 +267,7 @@ class WebDavHelper {
|
||||
null,
|
||||
null,
|
||||
[],
|
||||
$doDavRequestAsUser
|
||||
$doDavRequestAsUser,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class WebDavHelper {
|
||||
$spaceId,
|
||||
$body,
|
||||
$davPathVersionToUse,
|
||||
$type
|
||||
$type,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ class WebDavHelper {
|
||||
?array $propertiesArray,
|
||||
?int $davPathVersion = null,
|
||||
?string $namespaceString = null,
|
||||
?string $type = "files"
|
||||
?string $type = "files",
|
||||
): ResponseInterface {
|
||||
$propertyBody = "";
|
||||
foreach ($propertiesArray as $propertyArray) {
|
||||
@@ -395,7 +395,7 @@ class WebDavHelper {
|
||||
$matches = [];
|
||||
[$namespacePrefix, $namespace, $property] = self::getPropertyWithNamespaceInfo(
|
||||
$namespaceString,
|
||||
$property
|
||||
$property,
|
||||
);
|
||||
$propertyBody .= "\n\t<$namespacePrefix:$property>" .
|
||||
"$value" .
|
||||
@@ -422,7 +422,7 @@ class WebDavHelper {
|
||||
null,
|
||||
$body,
|
||||
$davPathVersion,
|
||||
$type
|
||||
$type,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ class WebDavHelper {
|
||||
?string $spaceId = null,
|
||||
?array $properties = null,
|
||||
?string $type = "files",
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW,
|
||||
): ResponseInterface {
|
||||
if (!$properties) {
|
||||
$properties = [
|
||||
@@ -467,7 +467,7 @@ class WebDavHelper {
|
||||
$folderDepth,
|
||||
$spaceId,
|
||||
$type,
|
||||
$davPathVersionToUse
|
||||
$davPathVersionToUse,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -531,22 +531,22 @@ class WebDavHelper {
|
||||
$fullUrl,
|
||||
'PROPFIND',
|
||||
$user,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
Assert::assertEquals(
|
||||
207,
|
||||
$response->getStatusCode(),
|
||||
"PROPFIND for user '$user' failed so the personal space id cannot be discovered"
|
||||
"PROPFIND for user '$user' failed so the personal space id cannot be discovered",
|
||||
);
|
||||
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath("/d:multistatus/d:response[1]/d:propstat/d:prop/oc:spaceid");
|
||||
Assert::assertNotEmpty(
|
||||
$xmlPart,
|
||||
"The 'oc:spaceid' for user '$user' was not found in the PROPFIND response"
|
||||
"The 'oc:spaceid' for user '$user' was not found in the PROPFIND response",
|
||||
);
|
||||
|
||||
$personalSpaceId = $xmlPart[0]->__toString();
|
||||
@@ -582,7 +582,7 @@ class WebDavHelper {
|
||||
return self::getPersonalSpaceIdForUser(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -715,7 +715,7 @@ class WebDavHelper {
|
||||
$headers[$key] = \str_replace(
|
||||
$urlSpecialChar[0],
|
||||
$urlSpecialChar[1],
|
||||
$value
|
||||
$value,
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -734,7 +734,7 @@ class WebDavHelper {
|
||||
$stream,
|
||||
$timeout,
|
||||
$client,
|
||||
$isGivenStep
|
||||
$isGivenStep,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ class WebDavHelper {
|
||||
public static function getDavPath(
|
||||
int $davPathVersion,
|
||||
?string $userOrItemIdOrSpaceIdOrToken = null,
|
||||
?string $type = "files"
|
||||
?string $type = "files",
|
||||
): string {
|
||||
switch ($type) {
|
||||
case 'archive':
|
||||
@@ -830,7 +830,7 @@ class WebDavHelper {
|
||||
?string $baseUrl,
|
||||
?string $fileName,
|
||||
?string $token,
|
||||
?int $davVersionToUse = self::DAV_VERSION_NEW
|
||||
?int $davVersionToUse = self::DAV_VERSION_NEW,
|
||||
): string {
|
||||
$response = self::propfind(
|
||||
$baseUrl,
|
||||
@@ -841,11 +841,11 @@ class WebDavHelper {
|
||||
'1',
|
||||
null,
|
||||
"public-files",
|
||||
$davVersionToUse
|
||||
$davVersionToUse,
|
||||
);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath("//d:getlastmodified");
|
||||
|
||||
@@ -883,11 +883,11 @@ class WebDavHelper {
|
||||
"0",
|
||||
$spaceId,
|
||||
"files",
|
||||
$davPathVersionToUse
|
||||
$davPathVersionToUse,
|
||||
);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath("//d:getlastmodified");
|
||||
Assert::assertArrayHasKey(
|
||||
@@ -895,7 +895,7 @@ class WebDavHelper {
|
||||
$xmlPart,
|
||||
__METHOD__
|
||||
. " XML part does not have key 0. Expected a value at index 0 of 'xmlPart' but, found: "
|
||||
. json_encode($xmlPart)
|
||||
. json_encode($xmlPart),
|
||||
);
|
||||
$mtime = new DateTime($xmlPart[0]->__toString());
|
||||
return $mtime->format('U');
|
||||
|
||||
@@ -114,7 +114,7 @@ class ArchiverContext implements Context {
|
||||
public function getArchiverQueryString(
|
||||
string $user,
|
||||
string $resource,
|
||||
string $addressType
|
||||
string $addressType,
|
||||
): string {
|
||||
switch ($addressType) {
|
||||
case 'id':
|
||||
@@ -128,7 +128,7 @@ class ArchiverContext implements Context {
|
||||
default:
|
||||
throw new Exception(
|
||||
'"' . $addressType .
|
||||
'" is not a legal value for $addressType, must be id|ids|remoteItemIds|path|paths'
|
||||
'" is not a legal value for $addressType, must be id|ids|remoteItemIds|path|paths',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -152,18 +152,18 @@ class ArchiverContext implements Context {
|
||||
string $archiveType,
|
||||
string $resource,
|
||||
string $addressType,
|
||||
TableNode $headersTable
|
||||
TableNode $headersTable,
|
||||
): void {
|
||||
$this->featureContext->verifyTableNodeColumns(
|
||||
$headersTable,
|
||||
['header', 'value']
|
||||
['header', 'value'],
|
||||
);
|
||||
$headers = [];
|
||||
foreach ($headersTable as $row) {
|
||||
$headers[$row['header']] = $row ['value'];
|
||||
}
|
||||
$this->featureContext->setResponse(
|
||||
$this->downloadArchive($user, $resource, $addressType, $archiveType, null, $headers)
|
||||
$this->downloadArchive($user, $resource, $addressType, $archiveType, null, $headers),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ class ArchiverContext implements Context {
|
||||
string $downloader,
|
||||
string $resource,
|
||||
string $owner,
|
||||
string $addressType
|
||||
string $addressType,
|
||||
): void {
|
||||
$this->featureContext->setResponse($this->downloadArchive($downloader, $resource, $addressType, null, $owner));
|
||||
}
|
||||
@@ -207,7 +207,7 @@ class ArchiverContext implements Context {
|
||||
string $addressType,
|
||||
?string $archiveType = null,
|
||||
?string $owner = null,
|
||||
?array $headers = null
|
||||
?array $headers = null,
|
||||
): ResponseInterface {
|
||||
$owner = $owner ?? $downloader;
|
||||
$downloader = $this->featureContext->getActualUsername($downloader);
|
||||
@@ -219,7 +219,7 @@ class ArchiverContext implements Context {
|
||||
$this->getArchiverUrl($queryString),
|
||||
$downloader,
|
||||
$this->featureContext->getPasswordForUser($downloader),
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ class ArchiverContext implements Context {
|
||||
public function userDownloadsTheArchiveOfTheseItems(
|
||||
string $user,
|
||||
string $addressType,
|
||||
TableNode $items
|
||||
TableNode $items,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$queryString = [];
|
||||
@@ -252,7 +252,7 @@ class ArchiverContext implements Context {
|
||||
$this->getArchiverUrl($queryString),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -302,12 +302,12 @@ class ArchiverContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$expectedItem['content'],
|
||||
$fileContent,
|
||||
__METHOD__ . " content of '" . $expectedPath . "' not as expected"
|
||||
__METHOD__ . " content of '" . $expectedPath . "' not as expected",
|
||||
);
|
||||
} else {
|
||||
Assert::assertFileExists(
|
||||
$fileFullPath,
|
||||
__METHOD__ . " File '" . $expectedPath . "' is not in the downloaded archive."
|
||||
__METHOD__ . " File '" . $expectedPath . "' is not in the downloaded archive.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class AuthAppContext implements Context {
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
["expiry" => $expiration],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class AuthAppContext implements Context {
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
["expiry" => $expiration]
|
||||
["expiry" => $expiration],
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
$this->lastCreatedToken = [
|
||||
@@ -130,7 +130,7 @@ class AuthAppContext implements Context {
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class AuthAppContext implements Context {
|
||||
200,
|
||||
"Failed creating auth-app token\n"
|
||||
. "HTTP status code 200 is not the expected value " . $response->getStatusCode(),
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
$this->lastCreatedToken = [
|
||||
"user" => strtolower($impersonatedUser),
|
||||
@@ -192,7 +192,7 @@ class AuthAppContext implements Context {
|
||||
"expiry" => $expiration,
|
||||
"userName" => $this->featureContext->getActualUsername($impersonatedUser),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ class AuthAppContext implements Context {
|
||||
$response = AuthAppHelper::listAllAppAuthTokensForUser(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$authAppTokens = json_decode($response->getBody()->getContents());
|
||||
foreach ($authAppTokens as $tokenObj) {
|
||||
@@ -218,7 +218,7 @@ class AuthAppContext implements Context {
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
$tokenObj->token
|
||||
$tokenObj->token,
|
||||
);
|
||||
$this->featureContext->setResponse($deleteResponse);
|
||||
$this->featureContext->pushToLastHttpStatusCodesArray((string)$deleteResponse->getStatusCode());
|
||||
@@ -243,7 +243,7 @@ class AuthAppContext implements Context {
|
||||
Assert::assertCount(
|
||||
$count,
|
||||
$authAppTokens,
|
||||
"Expected the count to be $count but got " . \count($authAppTokens)
|
||||
"Expected the count to be $count but got " . \count($authAppTokens),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ class AuthAppContext implements Context {
|
||||
public function userCreatesAppTokenWithUserIdForUserWithExpirationTimeUsingTheAuthAppApi(
|
||||
string $user,
|
||||
string $impersonatedUser,
|
||||
string $expiration
|
||||
string $expiration,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
AuthAppHelper::createAppAuthToken(
|
||||
@@ -271,7 +271,7 @@ class AuthAppContext implements Context {
|
||||
"expiry" => $expiration,
|
||||
"userID" => $this->featureContext->getUserIdByUserName($impersonatedUser),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,7 @@ class AuthContext implements Context {
|
||||
string $url,
|
||||
string $method,
|
||||
?string $body = null,
|
||||
?array $headers = []
|
||||
?array $headers = [],
|
||||
): ResponseInterface {
|
||||
// NOTE: preserving '/' for tests with special cases
|
||||
// E.g: coreApiAuth/webDavSpecialURLs.feature
|
||||
@@ -110,12 +110,12 @@ class AuthContext implements Context {
|
||||
string $method,
|
||||
?string $body = null,
|
||||
?array $headers = null,
|
||||
?string $property = null
|
||||
?string $property = null,
|
||||
): ResponseInterface {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$url = $this->featureContext->substituteInLineCodes(
|
||||
$url,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
$authHeader = $this->createBasicAuthHeader($user, $this->featureContext->getPasswordForUser($user));
|
||||
$headers = \array_merge($headers ?? [], $authHeader);
|
||||
@@ -128,7 +128,7 @@ class AuthContext implements Context {
|
||||
$url,
|
||||
$method,
|
||||
$body,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -159,14 +159,14 @@ class AuthContext implements Context {
|
||||
string $method,
|
||||
string $body,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$ofUser = \strtolower($this->featureContext->getActualUsername($ofUser));
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
$response = $this->sendRequest($row['endpoint'], $method, $body);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -187,14 +187,14 @@ class AuthContext implements Context {
|
||||
public function userRequestsEndpointsWithoutBodyAndNoAuthAboutUser(
|
||||
string $method,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$ofUser = \strtolower($this->featureContext->getActualUsername($ofUser));
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
$response = $this->sendRequest($row['endpoint'], $method);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -217,8 +217,8 @@ class AuthContext implements Context {
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendRequest(
|
||||
$this->featureContext->substituteInLineCodes($row['endpoint']),
|
||||
$method
|
||||
)
|
||||
$method,
|
||||
),
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
@@ -239,8 +239,8 @@ class AuthContext implements Context {
|
||||
$this->featureContext->setResponse(
|
||||
HttpRequestHelper::sendRequest(
|
||||
$this->featureContext->substituteInLineCodes($row['endpoint']),
|
||||
$method
|
||||
)
|
||||
$method,
|
||||
),
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
@@ -282,14 +282,14 @@ class AuthContext implements Context {
|
||||
string $method,
|
||||
string $property,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
$response = $this->requestUrlWithBasicAuth($user, $row['endpoint'], $method, null, null, $property);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -312,7 +312,7 @@ class AuthContext implements Context {
|
||||
$response = $this->requestUrlWithBasicAuth(
|
||||
$this->featureContext->getAdminUsername(),
|
||||
$row['endpoint'],
|
||||
$method
|
||||
$method,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
@@ -331,7 +331,7 @@ class AuthContext implements Context {
|
||||
public function userRequestsURLUsingBasicAuth(
|
||||
string $user,
|
||||
string $url,
|
||||
string $method
|
||||
string $method,
|
||||
): void {
|
||||
$response = $this->requestUrlWithBasicAuth($user, $url, $method);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -352,16 +352,16 @@ class AuthContext implements Context {
|
||||
string $user,
|
||||
string $url,
|
||||
string $method,
|
||||
TableNode $headersTable
|
||||
TableNode $headersTable,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$url = $this->featureContext->substituteInLineCodes(
|
||||
$url,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
$this->featureContext->verifyTableNodeColumns(
|
||||
$headersTable,
|
||||
['header', 'value']
|
||||
['header', 'value'],
|
||||
);
|
||||
$headers = [];
|
||||
foreach ($headersTable as $row) {
|
||||
@@ -373,8 +373,8 @@ class AuthContext implements Context {
|
||||
$url,
|
||||
$method,
|
||||
null,
|
||||
$headers
|
||||
)
|
||||
$headers,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ class AuthContext implements Context {
|
||||
string $user,
|
||||
string $method,
|
||||
string $password,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
@@ -424,7 +424,7 @@ class AuthContext implements Context {
|
||||
string $method,
|
||||
string $password,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||
@@ -435,12 +435,12 @@ class AuthContext implements Context {
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
if (isset($row['destination'])) {
|
||||
$destination = $this->featureContext->substituteInLineCodes(
|
||||
$row['destination'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
$headers['Destination'] = $this->featureContext->getBaseUrl()
|
||||
. "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/"));
|
||||
@@ -449,7 +449,7 @@ class AuthContext implements Context {
|
||||
$row['endpoint'],
|
||||
$method,
|
||||
null,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
@@ -475,7 +475,7 @@ class AuthContext implements Context {
|
||||
string $body,
|
||||
string $password,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||
@@ -486,12 +486,12 @@ class AuthContext implements Context {
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
if (isset($row['destination'])) {
|
||||
$destination = $this->featureContext->substituteInLineCodes(
|
||||
$row['destination'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
$headers['Destination'] = $this->featureContext->getBaseUrl()
|
||||
. "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/"));
|
||||
@@ -500,7 +500,7 @@ class AuthContext implements Context {
|
||||
$row['endpoint'],
|
||||
$method,
|
||||
$body,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
@@ -524,7 +524,7 @@ class AuthContext implements Context {
|
||||
string $method,
|
||||
string $body,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||
@@ -538,14 +538,14 @@ class AuthContext implements Context {
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
$response = $this->requestUrlWithBasicAuth(
|
||||
$user,
|
||||
$row['endpoint'],
|
||||
$method,
|
||||
$body,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
@@ -568,7 +568,7 @@ class AuthContext implements Context {
|
||||
string $asUser,
|
||||
string $method,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$asUser = $this->featureContext->getActualUsername($asUser);
|
||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||
@@ -580,13 +580,13 @@ class AuthContext implements Context {
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
$response = $this->sendRequest(
|
||||
$row['endpoint'],
|
||||
$method,
|
||||
null,
|
||||
$authHeader
|
||||
$authHeader,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
@@ -610,7 +610,7 @@ class AuthContext implements Context {
|
||||
string $method,
|
||||
?string $body,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$asUser = $this->featureContext->getActualUsername($asUser);
|
||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||
@@ -622,13 +622,13 @@ class AuthContext implements Context {
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
$response = $this->sendRequest(
|
||||
$row['endpoint'],
|
||||
$method,
|
||||
$body,
|
||||
$authHeader
|
||||
$authHeader,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
@@ -650,7 +650,7 @@ class AuthContext implements Context {
|
||||
string $user,
|
||||
string $method,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$headers = [];
|
||||
if ($method === 'MOVE' || $method === 'COPY') {
|
||||
@@ -666,14 +666,14 @@ class AuthContext implements Context {
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
$ofUser,
|
||||
);
|
||||
$response = $this->requestUrlWithBasicAuth(
|
||||
$user,
|
||||
$row['endpoint'],
|
||||
$method,
|
||||
null,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
@@ -692,12 +692,12 @@ class AuthContext implements Context {
|
||||
public function userRequestsURLWithoutRetry(
|
||||
string $user,
|
||||
string $endpoint,
|
||||
string $method
|
||||
string $method,
|
||||
): void {
|
||||
$username = $this->featureContext->getActualUsername($user);
|
||||
$endpoint = $this->featureContext->substituteInLineCodes(
|
||||
$endpoint,
|
||||
$username
|
||||
$username,
|
||||
);
|
||||
$endpoint = \ltrim($endpoint, '/');
|
||||
if (WebdavHelper::isDAVRequest($endpoint)) {
|
||||
@@ -708,7 +708,7 @@ class AuthContext implements Context {
|
||||
$fullUrl,
|
||||
$method,
|
||||
$username,
|
||||
$this->featureContext->getPasswordForUser($user)
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class CapabilitiesContext implements Context {
|
||||
'GET',
|
||||
'/cloud/capabilities' . ($formatJson ? '?format=json' : ''),
|
||||
[],
|
||||
$this->featureContext->getOcsApiVersion()
|
||||
$this->featureContext->getOcsApiVersion(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class CapabilitiesContext implements Context {
|
||||
public function getParameterValueFromXml(
|
||||
SimpleXMLElement $xml,
|
||||
string $capabilitiesApp,
|
||||
string $capabilitiesPath
|
||||
string $capabilitiesPath,
|
||||
): string {
|
||||
$path_to_element = \explode('@@@', $capabilitiesPath);
|
||||
$answeredValue = $xml->{$capabilitiesApp};
|
||||
@@ -172,7 +172,7 @@ class CapabilitiesContext implements Context {
|
||||
Assert::assertSame(
|
||||
1,
|
||||
$result,
|
||||
__METHOD__ . " version string '$versionString' does not start with a semver version"
|
||||
__METHOD__ . " version string '$versionString' does not start with a semver version",
|
||||
);
|
||||
// semVerParts should have an array with the 3 semver components of the version, e.g. "1", "9" and "2".
|
||||
$semVerParts = \explode('.', $matches[0]);
|
||||
@@ -185,17 +185,17 @@ class CapabilitiesContext implements Context {
|
||||
Assert::assertSame(
|
||||
$expectedMajor,
|
||||
$actualMajor,
|
||||
__METHOD__ . "'major' data item does not match with major version in string '$versionString'"
|
||||
__METHOD__ . "'major' data item does not match with major version in string '$versionString'",
|
||||
);
|
||||
Assert::assertSame(
|
||||
$expectedMinor,
|
||||
$actualMinor,
|
||||
__METHOD__ . "'minor' data item does not match with minor version in string '$versionString'"
|
||||
__METHOD__ . "'minor' data item does not match with minor version in string '$versionString'",
|
||||
);
|
||||
Assert::assertSame(
|
||||
$expectedMicro,
|
||||
$actualMicro,
|
||||
__METHOD__ . "'micro' data item does not match with micro (patch) version in string '$versionString'"
|
||||
__METHOD__ . "'micro' data item does not match with micro (patch) version in string '$versionString'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -218,35 +218,35 @@ class CapabilitiesContext implements Context {
|
||||
$edition = $this->getParameterValueFromXml(
|
||||
$responseXmlObject,
|
||||
'core',
|
||||
'status@@@edition'
|
||||
'status@@@edition',
|
||||
);
|
||||
|
||||
if (!\strlen($edition)) {
|
||||
Assert::fail(
|
||||
"Cannot get edition from core capabilities"
|
||||
"Cannot get edition from core capabilities",
|
||||
);
|
||||
}
|
||||
|
||||
$product = $this->getParameterValueFromXml(
|
||||
$responseXmlObject,
|
||||
'core',
|
||||
'status@@@product'
|
||||
'status@@@product',
|
||||
);
|
||||
if (!\strlen($product)) {
|
||||
Assert::fail(
|
||||
"Cannot get product from core capabilities"
|
||||
"Cannot get product from core capabilities",
|
||||
);
|
||||
}
|
||||
|
||||
$productName = $this->getParameterValueFromXml(
|
||||
$responseXmlObject,
|
||||
'core',
|
||||
'status@@@productname'
|
||||
'status@@@productname',
|
||||
);
|
||||
|
||||
if (!\strlen($productName)) {
|
||||
Assert::fail(
|
||||
"Cannot get productname from core capabilities"
|
||||
"Cannot get productname from core capabilities",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -259,24 +259,24 @@ class CapabilitiesContext implements Context {
|
||||
$version = $this->getParameterValueFromXml(
|
||||
$responseXmlObject,
|
||||
'core',
|
||||
'status@@@version'
|
||||
'status@@@version',
|
||||
);
|
||||
|
||||
if (!\strlen($version)) {
|
||||
Assert::fail(
|
||||
"Cannot get version from core capabilities"
|
||||
"Cannot get version from core capabilities",
|
||||
);
|
||||
}
|
||||
|
||||
$versionString = $this->getParameterValueFromXml(
|
||||
$responseXmlObject,
|
||||
'core',
|
||||
'status@@@versionstring'
|
||||
'status@@@versionstring',
|
||||
);
|
||||
|
||||
if (!\strlen($versionString)) {
|
||||
Assert::fail(
|
||||
"Cannot get versionstring from core capabilities"
|
||||
"Cannot get versionstring from core capabilities",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ class CapabilitiesContext implements Context {
|
||||
Assert::assertMatchesRegularExpression(
|
||||
"/^\d+\.\d+\.\d+\.\d+$/",
|
||||
$version,
|
||||
"version should be in a form like 10.9.8.1 but is $version"
|
||||
"version should be in a form like 10.9.8.1 but is $version",
|
||||
);
|
||||
if (\preg_match("/^(\d+\.\d+\.\d+)\.\d+(-[0-9A-Za-z-]+)?(\+[0-9A-Za-z-]+)?$/", $version, $matches)) {
|
||||
// We should have matched something like 10.9.8 - the first 3 numbers in the version.
|
||||
@@ -314,7 +314,7 @@ class CapabilitiesContext implements Context {
|
||||
Assert::assertArrayHasKey(
|
||||
1,
|
||||
$matches,
|
||||
"version $version could not match the pattern Major.Minor.Patch"
|
||||
"version $version could not match the pattern Major.Minor.Patch",
|
||||
);
|
||||
$majorMinorPatchVersion = $matches[1];
|
||||
} else {
|
||||
@@ -323,7 +323,7 @@ class CapabilitiesContext implements Context {
|
||||
Assert::assertStringStartsWith(
|
||||
$majorMinorPatchVersion,
|
||||
$versionString,
|
||||
"version string should start with $majorMinorPatchVersion but is $versionString"
|
||||
"version string should start with $majorMinorPatchVersion but is $versionString",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,17 +46,17 @@ class ChecksumContext implements Context {
|
||||
string $user,
|
||||
string $source,
|
||||
string $destination,
|
||||
string $checksum
|
||||
string $checksum,
|
||||
): ResponseInterface {
|
||||
$file = \file_get_contents(
|
||||
$this->featureContext->acceptanceTestsDirLocation() . $source
|
||||
$this->featureContext->acceptanceTestsDirLocation() . $source,
|
||||
);
|
||||
return $this->featureContext->makeDavRequest(
|
||||
$user,
|
||||
'PUT',
|
||||
$destination,
|
||||
['OC-Checksum' => $checksum],
|
||||
$file
|
||||
$file,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ class ChecksumContext implements Context {
|
||||
string $user,
|
||||
string $source,
|
||||
string $destination,
|
||||
string $checksum
|
||||
string $checksum,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->uploadFileToWithChecksumUsingTheAPI($user, $source, $destination, $checksum)
|
||||
$this->uploadFileToWithChecksumUsingTheAPI($user, $source, $destination, $checksum),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,14 +95,14 @@ class ChecksumContext implements Context {
|
||||
string $user,
|
||||
string $source,
|
||||
string $destination,
|
||||
string $checksum
|
||||
string $checksum,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$response = $this->uploadFileToWithChecksumUsingTheAPI(
|
||||
$user,
|
||||
$source,
|
||||
$destination,
|
||||
$checksum
|
||||
$checksum,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe([201,204], '', $response);
|
||||
}
|
||||
@@ -119,14 +119,14 @@ class ChecksumContext implements Context {
|
||||
string $user,
|
||||
string $content,
|
||||
string $checksum,
|
||||
string $destination
|
||||
string $destination,
|
||||
): ResponseInterface {
|
||||
return $this->featureContext->makeDavRequest(
|
||||
$user,
|
||||
'PUT',
|
||||
$destination,
|
||||
['OC-Checksum' => $checksum],
|
||||
$content
|
||||
$content,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class ChecksumContext implements Context {
|
||||
string $user,
|
||||
string $content,
|
||||
string $checksum,
|
||||
string $destination
|
||||
string $destination,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$response = $this->uploadFileWithContentAndChecksumToUsingTheAPI($user, $content, $checksum, $destination);
|
||||
@@ -188,7 +188,7 @@ class ChecksumContext implements Context {
|
||||
null,
|
||||
$spaceId,
|
||||
$body,
|
||||
$this->featureContext->getDavPathVersion()
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class ChecksumContext implements Context {
|
||||
public function asUserTheWebdavChecksumOfPathViaPropfindShouldMatch(
|
||||
string $user,
|
||||
string $path,
|
||||
string $expectedChecksum
|
||||
string $expectedChecksum,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$resource = $this->propfindResourceChecksum($user, $path);
|
||||
@@ -249,72 +249,72 @@ class ChecksumContext implements Context {
|
||||
Assert::assertIsArray(
|
||||
$parsed,
|
||||
__METHOD__
|
||||
. " could not parse response as XML. Expected parsed XML to be an array but found " . $bodyContents
|
||||
. " could not parse response as XML. Expected parsed XML to be an array but found " . $bodyContents,
|
||||
);
|
||||
Assert::assertArrayHasKey(
|
||||
0,
|
||||
$parsed,
|
||||
__METHOD__ . " parsed XML does not have key 0"
|
||||
__METHOD__ . " parsed XML does not have key 0",
|
||||
);
|
||||
$parsed0 = $parsed[0];
|
||||
Assert::assertArrayHasKey(
|
||||
'value',
|
||||
$parsed0,
|
||||
__METHOD__ . " parsed XML parsed0 does not have key value"
|
||||
__METHOD__ . " parsed XML parsed0 does not have key value",
|
||||
);
|
||||
$parsed0Value = $parsed0['value'];
|
||||
Assert::assertArrayHasKey(
|
||||
1,
|
||||
$parsed0Value,
|
||||
__METHOD__ . " parsed XML parsed0Value does not have key 1"
|
||||
__METHOD__ . " parsed XML parsed0Value does not have key 1",
|
||||
);
|
||||
$parsed0Value1 = $parsed0Value[1];
|
||||
Assert::assertArrayHasKey(
|
||||
'value',
|
||||
$parsed0Value1,
|
||||
__METHOD__ . " parsed XML parsed0Value1 does not have key value after key 1"
|
||||
__METHOD__ . " parsed XML parsed0Value1 does not have key value after key 1",
|
||||
);
|
||||
$parsed0Value1Value = $parsed0Value1['value'];
|
||||
Assert::assertArrayHasKey(
|
||||
0,
|
||||
$parsed0Value1Value,
|
||||
__METHOD__ . " parsed XML parsed0Value1Value does not have key 0"
|
||||
__METHOD__ . " parsed XML parsed0Value1Value does not have key 0",
|
||||
);
|
||||
$parsed0Value1Value0 = $parsed0Value1Value[0];
|
||||
Assert::assertArrayHasKey(
|
||||
'value',
|
||||
$parsed0Value1Value0,
|
||||
__METHOD__ . " parsed XML parsed0Value1Value0 does not have key value"
|
||||
__METHOD__ . " parsed XML parsed0Value1Value0 does not have key value",
|
||||
);
|
||||
$parsed0Value1Value0Value = $parsed0Value1Value0['value'];
|
||||
Assert::assertArrayHasKey(
|
||||
0,
|
||||
$parsed0Value1Value0Value,
|
||||
__METHOD__ . " parsed XML parsed0Value1Value0Value does not have key 0"
|
||||
__METHOD__ . " parsed XML parsed0Value1Value0Value does not have key 0",
|
||||
);
|
||||
$checksums = $parsed0Value1Value0Value[0];
|
||||
Assert::assertArrayHasKey(
|
||||
'value',
|
||||
$checksums,
|
||||
__METHOD__ . " parsed XML checksums does not have key value"
|
||||
__METHOD__ . " parsed XML checksums does not have key value",
|
||||
);
|
||||
$checksumsValue = $checksums['value'];
|
||||
Assert::assertArrayHasKey(
|
||||
0,
|
||||
$checksumsValue,
|
||||
__METHOD__ . " parsed XML checksumsValue does not have key 0"
|
||||
__METHOD__ . " parsed XML checksumsValue does not have key 0",
|
||||
);
|
||||
$checksumsValue0 = $checksumsValue[0];
|
||||
Assert::assertArrayHasKey(
|
||||
'value',
|
||||
$checksumsValue0,
|
||||
__METHOD__ . " parsed XML checksumsValue0 does not have key value"
|
||||
__METHOD__ . " parsed XML checksumsValue0 does not have key value",
|
||||
);
|
||||
$actualChecksum = $checksumsValue0['value'];
|
||||
Assert::assertEquals(
|
||||
$expectedChecksum,
|
||||
$actualChecksum,
|
||||
"Expected: webDav checksum should be $expectedChecksum but got $actualChecksum"
|
||||
"Expected: webDav checksum should be $expectedChecksum but got $actualChecksum",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -332,19 +332,19 @@ class ChecksumContext implements Context {
|
||||
|
||||
Assert::assertIsArray(
|
||||
$headerChecksums,
|
||||
__METHOD__ . " getHeader('OC-Checksum') did not return an array"
|
||||
__METHOD__ . " getHeader('OC-Checksum') did not return an array",
|
||||
);
|
||||
|
||||
Assert::assertNotEmpty(
|
||||
$headerChecksums,
|
||||
__METHOD__ . " getHeader('OC-Checksum') returned an empty array. No checksum header was found."
|
||||
__METHOD__ . " getHeader('OC-Checksum') returned an empty array. No checksum header was found.",
|
||||
);
|
||||
|
||||
$checksumCount = \count($headerChecksums);
|
||||
|
||||
Assert::assertTrue(
|
||||
$checksumCount === 1,
|
||||
__METHOD__ . " Expected 1 checksum in the header but found $checksumCount checksums"
|
||||
__METHOD__ . " Expected 1 checksum in the header but found $checksumCount checksums",
|
||||
);
|
||||
|
||||
$headerChecksum
|
||||
@@ -352,7 +352,7 @@ class ChecksumContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$expectedChecksum,
|
||||
$headerChecksum,
|
||||
"Expected: header checksum should match $expectedChecksum but got $headerChecksum"
|
||||
"Expected: header checksum should match $expectedChecksum but got $headerChecksum",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -369,26 +369,26 @@ class ChecksumContext implements Context {
|
||||
public function theHeaderChecksumWhenUserDownloadsFileUsingTheWebdavApiShouldMatch(
|
||||
string $user,
|
||||
string $fileName,
|
||||
string $expectedChecksum
|
||||
string $expectedChecksum,
|
||||
): void {
|
||||
$response = $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName);
|
||||
$headerChecksums = $response->getHeader('OC-Checksum');
|
||||
|
||||
Assert::assertIsArray(
|
||||
$headerChecksums,
|
||||
__METHOD__ . " getHeader('OC-Checksum') did not return an array"
|
||||
__METHOD__ . " getHeader('OC-Checksum') did not return an array",
|
||||
);
|
||||
|
||||
Assert::assertNotEmpty(
|
||||
$headerChecksums,
|
||||
__METHOD__ . " getHeader('OC-Checksum') returned an empty array. No checksum header was found."
|
||||
__METHOD__ . " getHeader('OC-Checksum') returned an empty array. No checksum header was found.",
|
||||
);
|
||||
|
||||
$checksumCount = \count($headerChecksums);
|
||||
|
||||
Assert::assertTrue(
|
||||
$checksumCount === 1,
|
||||
__METHOD__ . " Expected 1 checksum in the header but found $checksumCount checksums"
|
||||
__METHOD__ . " Expected 1 checksum in the header but found $checksumCount checksums",
|
||||
);
|
||||
|
||||
$headerChecksum
|
||||
@@ -396,7 +396,7 @@ class ChecksumContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$expectedChecksum,
|
||||
$headerChecksum,
|
||||
"Expected: header checksum should match $expectedChecksum but got $headerChecksum"
|
||||
"Expected: header checksum should match $expectedChecksum but got $headerChecksum",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ class ChecksumContext implements Context {
|
||||
int $total,
|
||||
string $data,
|
||||
string $destination,
|
||||
string $expectedChecksum
|
||||
string $expectedChecksum,
|
||||
): ResponseInterface {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$num -= 1;
|
||||
@@ -426,7 +426,7 @@ class ChecksumContext implements Context {
|
||||
'PUT',
|
||||
$file,
|
||||
['OC-Checksum' => $expectedChecksum, 'OC-Chunked' => '1'],
|
||||
$data
|
||||
$data,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ class ChecksumContext implements Context {
|
||||
int $total,
|
||||
string $data,
|
||||
string $destination,
|
||||
string $expectedChecksum
|
||||
string $expectedChecksum,
|
||||
): void {
|
||||
$response = $this->uploadChunkFileOfWithToWithChecksum(
|
||||
$user,
|
||||
@@ -456,7 +456,7 @@ class ChecksumContext implements Context {
|
||||
$total,
|
||||
$data,
|
||||
$destination,
|
||||
$expectedChecksum
|
||||
$expectedChecksum,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -479,7 +479,7 @@ class ChecksumContext implements Context {
|
||||
int $total,
|
||||
string $data,
|
||||
string $destination,
|
||||
string $expectedChecksum
|
||||
string $expectedChecksum,
|
||||
): void {
|
||||
$response = $this->uploadChunkFileOfWithToWithChecksum(
|
||||
$user,
|
||||
@@ -487,12 +487,12 @@ class ChecksumContext implements Context {
|
||||
$total,
|
||||
$data,
|
||||
$destination,
|
||||
$expectedChecksum
|
||||
$expectedChecksum,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
[201, 206],
|
||||
'',
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ class CliContext implements Context {
|
||||
public function theAdministratorResetsThePasswordOfUserUsingTheCLI(
|
||||
string $status,
|
||||
string $user,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$command = "idm resetpassword -u $user";
|
||||
$body = [
|
||||
@@ -149,7 +149,7 @@ class CliContext implements Context {
|
||||
*/
|
||||
public function theAdministratorCreatesAppTokenForUserWithExpirationTimeUsingTheAuthAppCLI(
|
||||
string $user,
|
||||
string $expirationTime
|
||||
string $expirationTime,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUserName($user);
|
||||
$command = "auth-app create --user-name=$user --expiration=$expirationTime";
|
||||
@@ -169,7 +169,7 @@ class CliContext implements Context {
|
||||
*/
|
||||
public function theAdministratorHasCreatedAppTokenForUserWithExpirationTimeUsingTheAuthAppCli(
|
||||
$user,
|
||||
$expirationTime
|
||||
$expirationTime,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUserName($user);
|
||||
$command = "auth-app create --user-name=$user --expiration=$expirationTime";
|
||||
@@ -183,7 +183,7 @@ class CliContext implements Context {
|
||||
Assert::assertSame(
|
||||
0,
|
||||
$jsonResponse["exitCode"],
|
||||
"Expected exit code to be 0, but got " . $jsonResponse["exitCode"]
|
||||
"Expected exit code to be 0, but got " . $jsonResponse["exitCode"],
|
||||
);
|
||||
$output = $this->featureContext->substituteInLineCodes("App token created for $user");
|
||||
Assert::assertStringContainsString($output, $jsonResponse["message"]);
|
||||
@@ -199,7 +199,7 @@ class CliContext implements Context {
|
||||
*/
|
||||
public function userHasCreatedAppTokenWithExpirationTimeUsingTheAuthAppCLI(
|
||||
string $user,
|
||||
string $expirationTime
|
||||
string $expirationTime,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUserName($user);
|
||||
$command = "auth-app create --user-name=$user --expiration=$expirationTime";
|
||||
@@ -214,7 +214,7 @@ class CliContext implements Context {
|
||||
Assert::assertSame(
|
||||
0,
|
||||
$jsonResponse["exitCode"],
|
||||
"Expected exit code to be 0, but got " . $jsonResponse["exitCode"]
|
||||
"Expected exit code to be 0, but got " . $jsonResponse["exitCode"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ class CliContext implements Context {
|
||||
Assert::assertSame(
|
||||
$expectedExitCode,
|
||||
$jsonResponse["exitCode"],
|
||||
"Expected exit code to be 0, but got " . $jsonResponse["exitCode"]
|
||||
"Expected exit code to be 0, but got " . $jsonResponse["exitCode"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -446,14 +446,14 @@ class CliContext implements Context {
|
||||
foreach ($expectedFiles as $expectedFile) {
|
||||
Assert::assertNotTrue(
|
||||
\in_array($expectedFile, $resourceNames),
|
||||
"The resource '$expectedFile' was found in the response."
|
||||
"The resource '$expectedFile' was found in the response.",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
foreach ($expectedFiles as $expectedFile) {
|
||||
Assert::assertTrue(
|
||||
\in_array($expectedFile, $resourceNames),
|
||||
"The resource '$expectedFile' was not found in the response."
|
||||
"The resource '$expectedFile' was not found in the response.",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -587,11 +587,11 @@ class CliContext implements Context {
|
||||
*/
|
||||
public function theAdministratorListsTheStaleUploadsOfSpace(
|
||||
string $spaceName,
|
||||
string $user
|
||||
string $user,
|
||||
): void {
|
||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||
$user,
|
||||
$spaceName
|
||||
$spaceName,
|
||||
);
|
||||
$this->featureContext->setResponse($this->listStaleUploads($spaceOwnerId));
|
||||
}
|
||||
@@ -611,7 +611,7 @@ class CliContext implements Context {
|
||||
Assert::assertSame(
|
||||
$expectedMessage,
|
||||
$actualMessage,
|
||||
"Expected cli output to be $expectedMessage but found $actualMessage"
|
||||
"Expected cli output to be $expectedMessage but found $actualMessage",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -634,11 +634,11 @@ class CliContext implements Context {
|
||||
*/
|
||||
public function theAdministratorDeletesTheStaleUploadsOfSpaceOwnedByUser(
|
||||
string $spaceName,
|
||||
string $user
|
||||
string $user,
|
||||
): void {
|
||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||
$user,
|
||||
$spaceName
|
||||
$spaceName,
|
||||
);
|
||||
$this->featureContext->setResponse($this->deleteStaleUploads($spaceOwnerId));
|
||||
}
|
||||
@@ -657,13 +657,13 @@ class CliContext implements Context {
|
||||
public function thereShouldBeStaleUploadsOfSpaceOwnedByUser(
|
||||
int $number,
|
||||
string $spaceName = '',
|
||||
string $user = ''
|
||||
string $user = '',
|
||||
): void {
|
||||
$spaceOwnerId = null;
|
||||
if ($spaceName !== '' && $user !== '') {
|
||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||
$user,
|
||||
$spaceName
|
||||
$spaceName,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ class CliContext implements Context {
|
||||
Assert::assertStringContainsString(
|
||||
$expectedMessage,
|
||||
$jsonDecodedResponse->message ?? '',
|
||||
"Expected message to contain '$expectedMessage', but got: " . ($jsonDecodedResponse->message ?? 'null')
|
||||
"Expected message to contain '$expectedMessage', but got: " . ($jsonDecodedResponse->message ?? 'null'),
|
||||
);
|
||||
|
||||
}
|
||||
@@ -691,11 +691,11 @@ class CliContext implements Context {
|
||||
*/
|
||||
public function theAdministratorListsAllTrashedResourceOfSpaceOwnedByUser(
|
||||
string $spaceName,
|
||||
string $user
|
||||
string $user,
|
||||
): void {
|
||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||
$user,
|
||||
$spaceName
|
||||
$spaceName,
|
||||
);
|
||||
$this->featureContext->setResponse($this->listTrashedResource($spaceOwnerId));
|
||||
}
|
||||
@@ -719,7 +719,7 @@ class CliContext implements Context {
|
||||
* @return array
|
||||
*/
|
||||
protected function getTrashedResourceFromCliCommandResponse(
|
||||
ResponseInterface $response = null
|
||||
ResponseInterface $response = null,
|
||||
): array {
|
||||
$responseArray = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
||||
$lines = explode("\n", $responseArray->message);
|
||||
@@ -729,7 +729,7 @@ class CliContext implements Context {
|
||||
if (preg_match(
|
||||
'/^\s*\|\s*([a-f0-9\-]{36})\s*\|\s*(.*?)\s*\|\s*(file|folder)\s*\|\s*([\d\-T:Z]+)\s*\|/',
|
||||
$line,
|
||||
$matches
|
||||
$matches,
|
||||
)
|
||||
) {
|
||||
$items[] = [
|
||||
@@ -757,7 +757,7 @@ class CliContext implements Context {
|
||||
*/
|
||||
public function theCommandOutputShouldContainTheFollowingTrashResource(
|
||||
int $count,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse();
|
||||
|
||||
@@ -777,7 +777,7 @@ class CliContext implements Context {
|
||||
|
||||
Assert::assertTrue(
|
||||
$matchFound,
|
||||
"Could not find expected resource '{$expectedRow['resource']}' of type '{$expectedRow['type']}'"
|
||||
"Could not find expected resource '{$expectedRow['resource']}' of type '{$expectedRow['type']}'",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -792,11 +792,11 @@ class CliContext implements Context {
|
||||
*/
|
||||
public function theAdministratorRestoresAllTheTrashedResourcesOfSpaceOwnedByUser(
|
||||
string $spaceName,
|
||||
string $user
|
||||
string $user,
|
||||
): void {
|
||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||
$user,
|
||||
$spaceName
|
||||
$spaceName,
|
||||
);
|
||||
$body = [
|
||||
"command" => "storage-users trash-bin restore-all -y $spaceOwnerId",
|
||||
@@ -815,11 +815,11 @@ class CliContext implements Context {
|
||||
*/
|
||||
public function thereShouldBeNoTrashedResourcesOfSpaceOwnedByUser(
|
||||
string $spaceName,
|
||||
string $user
|
||||
string $user,
|
||||
): void {
|
||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||
$user,
|
||||
$spaceName
|
||||
$spaceName,
|
||||
);
|
||||
$response = $this->listTrashedResource($spaceOwnerId);
|
||||
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse($response);
|
||||
@@ -842,11 +842,11 @@ class CliContext implements Context {
|
||||
int $number,
|
||||
string $spaceName,
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||
$user,
|
||||
$spaceName
|
||||
$spaceName,
|
||||
);
|
||||
$response = $this->listTrashedResource($spaceOwnerId);
|
||||
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse($response);
|
||||
@@ -867,7 +867,7 @@ class CliContext implements Context {
|
||||
|
||||
Assert::assertTrue(
|
||||
$matchFound,
|
||||
"Could not find expected resource '{$expectedRow['resource']}' of type '{$expectedRow['type']}'"
|
||||
"Could not find expected resource '{$expectedRow['resource']}' of type '{$expectedRow['type']}'",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -884,11 +884,11 @@ class CliContext implements Context {
|
||||
public function theAdministratorRestoresTheTrashedResourcesOfSpaceOwnedByUser(
|
||||
string $resource,
|
||||
string $spaceName,
|
||||
string $user
|
||||
string $user,
|
||||
): void {
|
||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||
$user,
|
||||
$spaceName
|
||||
$spaceName,
|
||||
);
|
||||
$response = $this->listTrashedResource($spaceOwnerId);
|
||||
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse($response);
|
||||
|
||||
@@ -91,7 +91,7 @@ class CollaborationContext implements Context {
|
||||
string $file,
|
||||
string $space,
|
||||
string $app,
|
||||
string $viewMode = null
|
||||
string $viewMode = null,
|
||||
): void {
|
||||
$fileId = $this->spacesContext->getFileId($user, $space, $file);
|
||||
$response = \json_decode(
|
||||
@@ -101,8 +101,8 @@ class CollaborationContext implements Context {
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$viewMode
|
||||
)->getBody()->getContents()
|
||||
$viewMode,
|
||||
)->getBody()->getContents(),
|
||||
);
|
||||
|
||||
$accessToken = $response->form_parameters->access_token;
|
||||
@@ -115,7 +115,7 @@ class CollaborationContext implements Context {
|
||||
$this->featureContext->setResponse(
|
||||
HttpRequestHelper::get(
|
||||
$wopiSrc . "?access_token=$accessToken",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class CollaborationContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $folder,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$parentContainerId = $this->spacesContext->getResourceId($user, $space, $folder);
|
||||
$this->featureContext->setResponse(
|
||||
@@ -144,8 +144,8 @@ class CollaborationContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$parentContainerId,
|
||||
$file
|
||||
)
|
||||
$file,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -168,8 +168,8 @@ class CollaborationContext implements Context {
|
||||
"$baseUrl/$davPath/$folder",
|
||||
"PROPFIND",
|
||||
"public",
|
||||
$this->featureContext->getActualPassword($password)
|
||||
)
|
||||
$this->featureContext->getActualPassword($password),
|
||||
),
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath("//d:prop/oc:fileid");
|
||||
$parentContainerId = (string) $xmlPart[0];
|
||||
@@ -184,8 +184,8 @@ class CollaborationContext implements Context {
|
||||
$this->featureContext->getActualPassword($password),
|
||||
$parentContainerId,
|
||||
$file,
|
||||
$headers
|
||||
)
|
||||
$headers,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ class CollaborationContext implements Context {
|
||||
*/
|
||||
public function thePublicCreatesAFileInsideTheLastSharedPublicLinkFolderWithPasswordUsingWopiEndpoint(
|
||||
string $file,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$this->createFile($file, $password);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ class CollaborationContext implements Context {
|
||||
public function thePublicCreatesAFileInsideFolderInTheLastSharedPublicLinkSpaceWithPasswordUsingWopiEndpoint(
|
||||
string $file,
|
||||
string $folder,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$this->createFile($file, $password, $folder);
|
||||
}
|
||||
@@ -242,7 +242,7 @@ class CollaborationContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $space,
|
||||
string $app
|
||||
string $app,
|
||||
): void {
|
||||
$response = \json_decode(
|
||||
CollaborationHelper::sendPOSTRequestToAppOpen(
|
||||
@@ -251,7 +251,7 @@ class CollaborationContext implements Context {
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$this->featureContext->getBaseUrl(),
|
||||
)->getBody()->getContents()
|
||||
)->getBody()->getContents(),
|
||||
);
|
||||
$accessToken = $response->form_parameters->access_token;
|
||||
|
||||
@@ -266,7 +266,7 @@ class CollaborationContext implements Context {
|
||||
$this->featureContext->setResponse(
|
||||
HttpRequestHelper::get(
|
||||
$fullUrl . "?access_token=$accessToken",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -287,8 +287,8 @@ class CollaborationContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$parentContainerId,
|
||||
$file
|
||||
)
|
||||
$file,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ class CollaborationContext implements Context {
|
||||
$this->featureContext->setResponse(
|
||||
HttpRequestHelper::get(
|
||||
$wopiSrc . "?access_token=$accessToken",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ class CollaborationContext implements Context {
|
||||
public function theFollowingMimeTypesShouldExistForUser(string $shouldOrNot, TableNode $table): void {
|
||||
$rows = $table->getRows();
|
||||
$responseArray = $this->featureContext->getJsonDecodedResponse(
|
||||
$this->featureContext->getResponse()
|
||||
$this->featureContext->getResponse(),
|
||||
)['mime-types'];
|
||||
$mimeTypes = \array_column($responseArray, 'mime_type');
|
||||
foreach ($rows as $row) {
|
||||
@@ -359,13 +359,13 @@ class CollaborationContext implements Context {
|
||||
Assert::assertFalse(
|
||||
\in_array($row[0], $mimeTypes),
|
||||
"the response should not contain the mimetype $row[0].\nMime Types found in response:\n"
|
||||
. print_r($mimeTypes, true)
|
||||
. print_r($mimeTypes, true),
|
||||
);
|
||||
} else {
|
||||
Assert::assertTrue(
|
||||
\in_array($row[0], $mimeTypes),
|
||||
"the response does not contain the mimetype $row[0].\nMime Types found in response:\n"
|
||||
. print_r($mimeTypes, true)
|
||||
. print_r($mimeTypes, true),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -381,14 +381,14 @@ class CollaborationContext implements Context {
|
||||
*/
|
||||
public function theAppListResponseShouldContainTheFollowingTemplateInformationForOffice(
|
||||
string $app,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse());
|
||||
|
||||
Assert::assertArrayHasKey(
|
||||
"mime-types",
|
||||
$responseArray,
|
||||
"Expected 'mime-types' in the response but not found.\n" . print_r($responseArray, true)
|
||||
"Expected 'mime-types' in the response but not found.\n" . print_r($responseArray, true),
|
||||
);
|
||||
|
||||
$mimeTypes = $responseArray['mime-types'];
|
||||
@@ -403,7 +403,7 @@ class CollaborationContext implements Context {
|
||||
$row['mime-type'],
|
||||
$mimeTypeMap,
|
||||
"Expected mime-type '{$row['mime-type']}' to exist in the response but it doesn't.\n"
|
||||
. print_r($mimeTypeMap, true)
|
||||
. print_r($mimeTypeMap, true),
|
||||
);
|
||||
|
||||
$mimeType = $mimeTypeMap[$row['mime-type']];
|
||||
@@ -415,7 +415,7 @@ class CollaborationContext implements Context {
|
||||
$row['target-extension'],
|
||||
$provider['target_ext'],
|
||||
"Expected 'target_ext' for $app to be '{$row['target-extension']}'"
|
||||
. " but found '{$provider['target_ext']}'"
|
||||
. " but found '{$provider['target_ext']}'",
|
||||
);
|
||||
$found = true;
|
||||
break;
|
||||
@@ -427,7 +427,7 @@ class CollaborationContext implements Context {
|
||||
"Expected response to contain app-provider '$app' with target-extension "
|
||||
. "'{$row['target-extension']}' for mime-type '{$row['mime-type']}',"
|
||||
. " but no matching provider was found.\n App Providers Found: "
|
||||
. print_r($mimeType['app_providers'], true)
|
||||
. print_r($mimeType['app_providers'], true),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -449,7 +449,7 @@ class CollaborationContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$parentContainerId,
|
||||
$file
|
||||
$file,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
$decodedResponse = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
||||
|
||||
@@ -66,7 +66,7 @@ class EmailContext implements Context {
|
||||
string $user,
|
||||
string $sender,
|
||||
string $spaceName,
|
||||
PyStringNode $content
|
||||
PyStringNode $content,
|
||||
): void {
|
||||
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
||||
$this->featureContext->setResponse(
|
||||
@@ -75,7 +75,7 @@ class EmailContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
'',
|
||||
)
|
||||
),
|
||||
);
|
||||
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
||||
$rawExpectedEmailBodyContent,
|
||||
@@ -88,7 +88,7 @@ class EmailContext implements Context {
|
||||
[$this->spacesContext, "getSpaceIdByName"],
|
||||
"parameter" => [$sender, $spaceName],
|
||||
],
|
||||
]
|
||||
],
|
||||
);
|
||||
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
||||
}
|
||||
@@ -106,12 +106,12 @@ class EmailContext implements Context {
|
||||
public function userShouldHaveReceivedTheFollowingEmailFromUser(
|
||||
string $user,
|
||||
string $sender,
|
||||
PyStringNode $content
|
||||
PyStringNode $content,
|
||||
): void {
|
||||
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
||||
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
||||
$rawExpectedEmailBodyContent,
|
||||
$sender
|
||||
$sender,
|
||||
);
|
||||
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class EmailContext implements Context {
|
||||
Assert::assertSame(
|
||||
$count,
|
||||
$emails["messages_count"],
|
||||
"Expected '$address' received mail total '$count' email but got " . $emails["messages_count"] . " email"
|
||||
"Expected '$address' received mail total '$count' email but got " . $emails["messages_count"] . " email",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -159,12 +159,12 @@ class EmailContext implements Context {
|
||||
public function userShouldHaveReceivedTheFollowingEmailFromUserIgnoringWhitespaces(
|
||||
string $user,
|
||||
string $sender,
|
||||
PyStringNode $content
|
||||
PyStringNode $content,
|
||||
): void {
|
||||
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
||||
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
||||
$rawExpectedEmailBodyContent,
|
||||
$sender
|
||||
$sender,
|
||||
);
|
||||
$this->assertEmailContains($user, $expectedEmailBodyContent, true);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ class EmailContext implements Context {
|
||||
public function assertEmailContains(
|
||||
string $user,
|
||||
string $expectedEmailBodyContent,
|
||||
$ignoreWhiteSpace = false
|
||||
$ignoreWhiteSpace = false,
|
||||
): void {
|
||||
$address = $this->featureContext->getEmailAddressForUser($user);
|
||||
$actualEmailBodyContent = $this->getBodyOfLastEmail($address);
|
||||
@@ -193,7 +193,7 @@ class EmailContext implements Context {
|
||||
$actualEmailBodyContent,
|
||||
"The email address '$address' should have received an"
|
||||
. "email with the body containing $expectedEmailBodyContent
|
||||
but the received email is $actualEmailBodyContent"
|
||||
but the received email is $actualEmailBodyContent",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -210,23 +210,23 @@ class EmailContext implements Context {
|
||||
*/
|
||||
public function getBodyOfLastEmail(
|
||||
string $emailAddress,
|
||||
?int $waitTimeSec = EMAIL_WAIT_TIMEOUT_SEC
|
||||
?int $waitTimeSec = EMAIL_WAIT_TIMEOUT_SEC,
|
||||
): string {
|
||||
$currentTime = \time();
|
||||
$endTime = $currentTime + $waitTimeSec;
|
||||
while ($currentTime <= $endTime) {
|
||||
$query = 'to:' . $emailAddress;
|
||||
$mailResponse = $this->featureContext->getJsonDecodedResponse(
|
||||
EmailHelper::searchEmails($query)
|
||||
EmailHelper::searchEmails($query),
|
||||
);
|
||||
if ($mailResponse["messages_count"] > 0) {
|
||||
$lastEmail = $this->featureContext->getJsonDecodedResponse(
|
||||
EmailHelper::getEmailById("latest", $query)
|
||||
EmailHelper::getEmailById("latest", $query),
|
||||
);
|
||||
$body = \str_replace(
|
||||
"\r\n",
|
||||
"\n",
|
||||
\quoted_printable_decode($lastEmail["Text"] . "\n" . $lastEmail["HTML"])
|
||||
\quoted_printable_decode($lastEmail["Text"] . "\n" . $lastEmail["HTML"]),
|
||||
);
|
||||
return $body;
|
||||
}
|
||||
@@ -247,11 +247,11 @@ class EmailContext implements Context {
|
||||
*/
|
||||
public function userShouldHaveReceivedTheFollowingGroupedEmail(
|
||||
string $user,
|
||||
PyStringNode $content
|
||||
PyStringNode $content,
|
||||
): void {
|
||||
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
||||
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
||||
$rawExpectedEmailBodyContent
|
||||
$rawExpectedEmailBodyContent,
|
||||
);
|
||||
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class FavoritesContext implements Context {
|
||||
$user,
|
||||
$path,
|
||||
1,
|
||||
$spaceId
|
||||
$spaceId,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -115,14 +115,14 @@ class FavoritesContext implements Context {
|
||||
public function checkFavoritedElements(
|
||||
string $user,
|
||||
string $shouldOrNot,
|
||||
TableNode $expectedElements
|
||||
TableNode $expectedElements,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$this->userListsFavorites($user);
|
||||
$this->featureContext->propfindResultShouldContainEntries(
|
||||
$shouldOrNot,
|
||||
$expectedElements,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class FavoritesContext implements Context {
|
||||
null,
|
||||
null,
|
||||
$body,
|
||||
$this->featureContext->getDavPathVersion()
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ class FavoritesContext implements Context {
|
||||
string $user,
|
||||
string $path,
|
||||
int $expectedValue = 1,
|
||||
string $spaceId = null
|
||||
string $spaceId = null,
|
||||
): void {
|
||||
$property = "oc:favorite";
|
||||
$this->webDavPropertiesContext->checkPropertyOfAFolder(
|
||||
@@ -231,7 +231,7 @@ class FavoritesContext implements Context {
|
||||
"oc='http://owncloud.org/ns'",
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
'files',
|
||||
$spaceId
|
||||
$spaceId,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ class FavoritesContext implements Context {
|
||||
$this->webDavPropertiesContext = BehatHelper::getContext(
|
||||
$scope,
|
||||
$environment,
|
||||
'WebDavPropertiesContext'
|
||||
'WebDavPropertiesContext',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,13 +259,13 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*/
|
||||
public function pushToLastStatusCodesArrays(): void {
|
||||
$this->pushToLastHttpStatusCodesArray(
|
||||
(string)$this->getResponse()->getStatusCode()
|
||||
(string)$this->getResponse()->getStatusCode(),
|
||||
);
|
||||
try {
|
||||
$this->pushToLastOcsCodesArray(
|
||||
$this->ocsContext->getOCSResponseStatusCode(
|
||||
$this->getResponse()
|
||||
)
|
||||
$this->getResponse(),
|
||||
),
|
||||
);
|
||||
} catch (Exception $exception) {
|
||||
// if response couldn't be converted into xml then push "notset" to last ocs status codes array
|
||||
@@ -402,7 +402,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
if (($this->userReplacements === null) && $this->isTestingReplacingUsernames()) {
|
||||
$this->userReplacements = \json_decode(
|
||||
\file_get_contents("./tests/acceptance/usernames.json"),
|
||||
true
|
||||
true,
|
||||
);
|
||||
// Loop through the user replacements, and make entries for the lower
|
||||
// and upper case forms. This allows for steps that specifically
|
||||
@@ -413,14 +413,14 @@ class FeatureContext extends BehatVariablesContext {
|
||||
if ($lowerKey !== $key) {
|
||||
$this->userReplacements[$lowerKey] = $value;
|
||||
$this->userReplacements[$lowerKey]['username'] = \strtolower(
|
||||
$this->userReplacements[$lowerKey]['username']
|
||||
$this->userReplacements[$lowerKey]['username'],
|
||||
);
|
||||
}
|
||||
$upperKey = \strtoupper($key);
|
||||
if ($upperKey !== $key) {
|
||||
$this->userReplacements[$upperKey] = $value;
|
||||
$this->userReplacements[$upperKey]['username'] = \strtoupper(
|
||||
$this->userReplacements[$upperKey]['username']
|
||||
$this->userReplacements[$upperKey]['username'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -882,7 +882,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
public function addGuzzleClientHeaders(array $guzzleClientHeaders): void {
|
||||
$this->guzzleClientHeaders = \array_merge(
|
||||
$this->guzzleClientHeaders,
|
||||
$guzzleClientHeaders
|
||||
$guzzleClientHeaders,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -979,7 +979,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*/
|
||||
public function setResponse(
|
||||
?ResponseInterface $response,
|
||||
string $username = ""
|
||||
string $username = "",
|
||||
): void {
|
||||
$this->response = $response;
|
||||
$this->responseUser = $username;
|
||||
@@ -1023,7 +1023,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
Assert::assertContains(
|
||||
\ltrim($validator, "$"),
|
||||
$this->jsonSchemaValidators,
|
||||
"Invalid schema validator: '$validator'"
|
||||
"Invalid schema validator: '$validator'",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1108,7 +1108,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
Assert::assertEquals(
|
||||
$schemaObj->minItems,
|
||||
$schemaObj->maxItems,
|
||||
"'minItems' and 'maxItems' should be equal for strict assertion"
|
||||
"'minItems' and 'maxItems' should be equal for strict assertion",
|
||||
);
|
||||
|
||||
// check optional validators
|
||||
@@ -1125,31 +1125,31 @@ class FeatureContext extends BehatVariablesContext {
|
||||
foreach ($value as $element) {
|
||||
Assert::assertNotNull(
|
||||
$element->oneOf,
|
||||
"'oneOf' is required to assert more than one elements"
|
||||
"'oneOf' is required to assert more than one elements",
|
||||
);
|
||||
}
|
||||
Assert::fail("'$validator' should be an object not an array");
|
||||
}
|
||||
Assert::assertFalse(
|
||||
$value->allOf || $value->anyOf,
|
||||
"'allOf' and 'anyOf' are not allowed in array"
|
||||
"'allOf' and 'anyOf' are not allowed in array",
|
||||
);
|
||||
if ($value->oneOf) {
|
||||
Assert::assertNotNull(
|
||||
$value->oneOf,
|
||||
"'oneOf' is required to assert more than one elements"
|
||||
"'oneOf' is required to assert more than one elements",
|
||||
);
|
||||
Assert::assertTrue(\is_array($value->oneOf), "'oneOf' should be an array");
|
||||
Assert::assertEquals(
|
||||
$schemaObj->maxItems,
|
||||
\count($value->oneOf),
|
||||
"Expected " . $schemaObj->maxItems . " 'oneOf' items but got " . \count($value->oneOf)
|
||||
"Expected " . $schemaObj->maxItems . " 'oneOf' items but got " . \count($value->oneOf),
|
||||
);
|
||||
}
|
||||
}
|
||||
Assert::assertTrue(
|
||||
\is_object($value),
|
||||
"'$validator' should be an object when expecting 1 element"
|
||||
"'$validator' should be an object when expecting 1 element",
|
||||
);
|
||||
break;
|
||||
case "uniqueItems":
|
||||
@@ -1334,8 +1334,8 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$method,
|
||||
"public",
|
||||
$password,
|
||||
$headers
|
||||
)
|
||||
$headers,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1355,11 +1355,11 @@ class FeatureContext extends BehatVariablesContext {
|
||||
string $user,
|
||||
string $verb,
|
||||
string $url,
|
||||
TableNode $headersTable
|
||||
TableNode $headersTable,
|
||||
): void {
|
||||
$this->verifyTableNodeColumns(
|
||||
$headersTable,
|
||||
['header', 'value']
|
||||
['header', 'value'],
|
||||
);
|
||||
|
||||
$user = $this->getActualUsername($user);
|
||||
@@ -1386,7 +1386,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
function ($subArray) {
|
||||
return $subArray[0];
|
||||
},
|
||||
$arrayOfArrays
|
||||
$arrayOfArrays,
|
||||
);
|
||||
return $a;
|
||||
}
|
||||
@@ -1405,7 +1405,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
string $user,
|
||||
string $method,
|
||||
string $davPath,
|
||||
string $content
|
||||
string $content,
|
||||
): void {
|
||||
$this->setResponse($this->sendingToWithDirectUrl($user, $method, $davPath, $content));
|
||||
}
|
||||
@@ -1424,7 +1424,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
string $user,
|
||||
string $verb,
|
||||
string $url,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$this->setResponse($this->sendingToWithDirectUrl($user, $verb, $url, null, $password));
|
||||
}
|
||||
@@ -1446,7 +1446,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
string $url,
|
||||
?string $body = null,
|
||||
?string $password = null,
|
||||
?array $headers = null
|
||||
?array $headers = null,
|
||||
): ResponseInterface {
|
||||
$url = \ltrim($url, '/');
|
||||
if (WebdavHelper::isDAVRequest($url)) {
|
||||
@@ -1490,7 +1490,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$reqHeaders,
|
||||
$body,
|
||||
$config,
|
||||
$cookies
|
||||
$cookies,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1533,7 +1533,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
public function theHTTPStatusCodeShouldBe(
|
||||
$expectedStatusCode,
|
||||
?string $message = "",
|
||||
?ResponseInterface $response = null
|
||||
?ResponseInterface $response = null,
|
||||
): void {
|
||||
$response = $response ?? $this->response;
|
||||
$actualStatusCode = $response->getStatusCode();
|
||||
@@ -1546,7 +1546,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
Assert::assertContainsEquals(
|
||||
$actualStatusCode,
|
||||
$expectedStatusCode,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
} else {
|
||||
if ($message === "") {
|
||||
@@ -1556,7 +1556,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
Assert::assertEquals(
|
||||
$expectedStatusCode,
|
||||
$actualStatusCode,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1599,12 +1599,12 @@ class FeatureContext extends BehatVariablesContext {
|
||||
* @throws Exception
|
||||
*/
|
||||
public function theOcsDataOfTheResponseShouldMatch(
|
||||
PyStringNode $schemaString
|
||||
PyStringNode $schemaString,
|
||||
): void {
|
||||
$jsonResponse = $this->getJsonDecodedResponseBodyContent();
|
||||
$this->assertJsonDocumentMatchesSchema(
|
||||
$jsonResponse->ocs->data,
|
||||
$this->getJSONSchema($schemaString)
|
||||
$this->getJSONSchema($schemaString),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1620,7 +1620,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$responseBody = $this->getJsonDecodedResponseBodyContent();
|
||||
$this->assertJsonDocumentMatchesSchema(
|
||||
$responseBody,
|
||||
$this->getJSONSchema($schemaString)
|
||||
$this->getJSONSchema($schemaString),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1645,7 +1645,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*/
|
||||
public function theHTTPStatusCodeShouldBeOr($statusCode1, $statusCode2): void {
|
||||
$this->theHTTPStatusCodeShouldBe(
|
||||
[$statusCode1, $statusCode2]
|
||||
[$statusCode1, $statusCode2],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1661,7 +1661,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
public function theHTTPStatusCodeShouldBeBetween(
|
||||
$minStatusCode,
|
||||
$maxStatusCode,
|
||||
?ResponseInterface $response = null
|
||||
?ResponseInterface $response = null,
|
||||
): void {
|
||||
$response = $response ?? $this->response;
|
||||
$statusCode = $response->getStatusCode();
|
||||
@@ -1669,12 +1669,12 @@ class FeatureContext extends BehatVariablesContext {
|
||||
Assert::assertGreaterThanOrEqual(
|
||||
$minStatusCode,
|
||||
$statusCode,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
Assert::assertLessThanOrEqual(
|
||||
$maxStatusCode,
|
||||
$statusCode,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1692,7 +1692,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
Assert::assertGreaterThanOrEqual(
|
||||
400,
|
||||
$statusCode,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1743,7 +1743,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$dirPathFromServerRoot,
|
||||
$this->getBaseUrl(),
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword()
|
||||
$this->getAdminPassword(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2027,7 +2027,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$this->getAdminPassword(),
|
||||
$this->guzzleClientHeaders,
|
||||
null,
|
||||
$config
|
||||
$config,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2042,7 +2042,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
return \json_decode(
|
||||
(string)$response->getBody(),
|
||||
true
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2052,7 +2052,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*/
|
||||
public function getJsonDecodedStatusPhp(): array {
|
||||
return $this->getJsonDecodedResponse(
|
||||
$this->getStatusPhp()
|
||||
$this->getStatusPhp(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2149,7 +2149,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
?array $functions = [],
|
||||
?array $additionalSubstitutions = [],
|
||||
?string $group = null,
|
||||
?string $userName = null
|
||||
?string $userName = null,
|
||||
): ?string {
|
||||
$substitutions = [
|
||||
[
|
||||
@@ -2540,7 +2540,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
"function" =>
|
||||
[$this, "getGroupIdByGroupName"],
|
||||
"parameter" => [$group],
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
if (!OcisHelper::isTestingOnReva()) {
|
||||
@@ -2553,7 +2553,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
"getSpaceIdByName",
|
||||
],
|
||||
"parameter" => [$user, "Shares"],
|
||||
]
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2569,7 +2569,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
|
||||
$replacement = \call_user_func_array(
|
||||
$substitution["function"],
|
||||
$substitution["parameter"]
|
||||
$substitution["parameter"],
|
||||
);
|
||||
|
||||
// do not run functions on regex patterns
|
||||
@@ -2577,14 +2577,14 @@ class FeatureContext extends BehatVariablesContext {
|
||||
foreach ($functions as $function => $parameters) {
|
||||
$replacement = \call_user_func_array(
|
||||
$function,
|
||||
\array_merge([$replacement], $parameters)
|
||||
\array_merge([$replacement], $parameters),
|
||||
);
|
||||
}
|
||||
}
|
||||
$value = \str_replace(
|
||||
$substitution["code"],
|
||||
$replacement,
|
||||
$value
|
||||
$value,
|
||||
);
|
||||
}
|
||||
return $value;
|
||||
@@ -2700,7 +2700,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
if ($this->adminPassword !== $this->originalAdminPassword) {
|
||||
$this->resetUserPasswordAsAdminUsingTheProvisioningApi(
|
||||
$this->getAdminUsername(),
|
||||
$this->originalAdminPassword
|
||||
$this->originalAdminPassword,
|
||||
);
|
||||
$this->adminPassword = $this->originalAdminPassword;
|
||||
}
|
||||
@@ -2725,7 +2725,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*/
|
||||
public function makeTemporaryStorageOnServerBefore(): void {
|
||||
$this->mkDirOnServer(
|
||||
TEMPORARY_STORAGE_DIR_ON_REMOTE_SERVER
|
||||
TEMPORARY_STORAGE_DIR_ON_REMOTE_SERVER,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2738,7 +2738,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
public function removeTemporaryStorageOnServerAfter(): void {
|
||||
SetupHelper::rmDirOnServer(
|
||||
TEMPORARY_STORAGE_DIR_ON_REMOTE_SERVER,
|
||||
HttpRequestHelper::getCurrentScenarioRef()
|
||||
HttpRequestHelper::getCurrentScenarioRef(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2780,7 +2780,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
public function verifyTableNodeColumns(
|
||||
?TableNode $table,
|
||||
?array $requiredHeader = [],
|
||||
?array $allowedHeader = []
|
||||
?array $allowedHeader = [],
|
||||
): void {
|
||||
if ($table === null || \count($table->getHash()) < 1) {
|
||||
throw new Exception("Table should have at least one row.");
|
||||
@@ -2897,7 +2897,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$this->getBaseUrl(),
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword(),
|
||||
$userName
|
||||
$userName,
|
||||
);
|
||||
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
|
||||
if (isset($data["id"])) {
|
||||
@@ -2919,7 +2919,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$this->getBaseUrl(),
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword(),
|
||||
$groupName
|
||||
$groupName,
|
||||
);
|
||||
$data = $this->getJsonDecodedResponse($response);
|
||||
if (isset($data["id"])) {
|
||||
|
||||
@@ -95,7 +95,7 @@ class FilesVersionsContext implements Context {
|
||||
public function thePublicTriesToGetTheNumberOfVersionsOfFileWithPasswordUsingFileId(
|
||||
string $file,
|
||||
string $password,
|
||||
string $fileId
|
||||
string $fileId,
|
||||
): void {
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
$this->featureContext->setResponse(
|
||||
@@ -109,8 +109,8 @@ class FilesVersionsContext implements Context {
|
||||
"versions",
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
false,
|
||||
$password
|
||||
)
|
||||
$password,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class FilesVersionsContext implements Context {
|
||||
Assert::assertNotNull(
|
||||
$fileId,
|
||||
__METHOD__
|
||||
. " fileid of file $file user $fileOwner not found (the file may not exist)"
|
||||
. " fileid of file $file user $fileOwner not found (the file may not exist)",
|
||||
);
|
||||
return $this->featureContext->makeDavRequest(
|
||||
$user,
|
||||
@@ -145,7 +145,7 @@ class FilesVersionsContext implements Context {
|
||||
null,
|
||||
null,
|
||||
$spaceId,
|
||||
"versions"
|
||||
"versions",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -167,8 +167,8 @@ class FilesVersionsContext implements Context {
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"versions"
|
||||
)
|
||||
"versions",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ class FilesVersionsContext implements Context {
|
||||
Assert::assertNotNull(
|
||||
$fileId,
|
||||
__METHOD__
|
||||
. " fileid of file $file user $user not found (the file may not exist)"
|
||||
. " fileid of file $file user $user not found (the file may not exist)",
|
||||
);
|
||||
$body = '<?xml version="1.0"?>
|
||||
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
|
||||
@@ -232,12 +232,12 @@ class FilesVersionsContext implements Context {
|
||||
Assert::assertNotNull(
|
||||
$fileId,
|
||||
__METHOD__
|
||||
. " fileid of file $path user $user not found (the file may not exist)"
|
||||
. " fileid of file $path user $user not found (the file may not exist)",
|
||||
);
|
||||
$response = $this->listVersionFolder($user, $fileId, 1);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath("//d:response/d:href");
|
||||
// restoring the version only works with DAV path v2
|
||||
@@ -250,7 +250,7 @@ class FilesVersionsContext implements Context {
|
||||
'COPY',
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
['Destination' => $destinationUrl]
|
||||
['Destination' => $destinationUrl],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ class FilesVersionsContext implements Context {
|
||||
$response = $this->listVersionFolder($user, $fileId, 1);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$actualCount = \count($responseXmlObject->xpath("//d:prop/d:getetag")) - 1;
|
||||
if ($actualCount === -1) {
|
||||
@@ -307,7 +307,7 @@ class FilesVersionsContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$expectedCount,
|
||||
$actualCount,
|
||||
"Expected $expectedCount versions but found $actualCount in \n" . $responseXmlObject->asXML()
|
||||
"Expected $expectedCount versions but found $actualCount in \n" . $responseXmlObject->asXML(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -324,14 +324,14 @@ class FilesVersionsContext implements Context {
|
||||
public function theVersionFolderOfFileShouldContainElements(
|
||||
string $path,
|
||||
string $user,
|
||||
int $count
|
||||
int $count,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||
Assert::assertNotNull(
|
||||
$fileId,
|
||||
__METHOD__
|
||||
. ". file '$path' for user '$user' not found (the file may not exist)"
|
||||
. ". file '$path' for user '$user' not found (the file may not exist)",
|
||||
);
|
||||
$this->assertFileVersionsCount($user, $fileId, $count);
|
||||
}
|
||||
@@ -349,7 +349,7 @@ class FilesVersionsContext implements Context {
|
||||
public function theVersionFolderOfFileIdShouldContainElements(
|
||||
string $fileId,
|
||||
string $user,
|
||||
int $count
|
||||
int $count,
|
||||
): void {
|
||||
$this->assertFileVersionsCount($user, $fileId, $count);
|
||||
}
|
||||
@@ -369,26 +369,26 @@ class FilesVersionsContext implements Context {
|
||||
string $path,
|
||||
int $index,
|
||||
string $user,
|
||||
int $length
|
||||
int $length,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||
Assert::assertNotNull(
|
||||
$fileId,
|
||||
__METHOD__
|
||||
. " fileid of file $path user $user not found (the file may not exist)"
|
||||
. " fileid of file $path user $user not found (the file may not exist)",
|
||||
);
|
||||
$response = $this->listVersionFolder($user, $fileId, 1, ['d:getcontentlength']);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath("//d:prop/d:getcontentlength");
|
||||
Assert::assertEquals(
|
||||
$length,
|
||||
(int) $xmlPart[$index],
|
||||
"The content length of file $path with version $index for user $user was
|
||||
expected to be $length but the actual content length is $xmlPart[$index]"
|
||||
expected to be $length but the actual content length is $xmlPart[$index]",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -405,23 +405,23 @@ class FilesVersionsContext implements Context {
|
||||
public function asUsersAuthorsOfVersionsOfFileShouldBe(
|
||||
string $users,
|
||||
string $filename,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$this->featureContext->verifyTableNodeColumns(
|
||||
$table,
|
||||
['index', 'author']
|
||||
['index', 'author'],
|
||||
);
|
||||
$requiredVersionMetadata = $table->getHash();
|
||||
$usersArray = \explode(",", $users);
|
||||
foreach ($usersArray as $username) {
|
||||
$actualUsername = $this->featureContext->getActualUsername($username);
|
||||
$this->featureContext->setResponse(
|
||||
$this->getFileVersionMetadata($actualUsername, $filename)
|
||||
$this->getFileVersionMetadata($actualUsername, $filename),
|
||||
);
|
||||
foreach ($requiredVersionMetadata as $versionMetadata) {
|
||||
$this->featureContext->checkAuthorOfAVersionOfFile(
|
||||
$versionMetadata['index'],
|
||||
$versionMetadata['author']
|
||||
$versionMetadata['author'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -440,14 +440,14 @@ class FilesVersionsContext implements Context {
|
||||
string $user,
|
||||
string $path,
|
||||
string $index,
|
||||
?string $spaceId = null
|
||||
?string $spaceId = null,
|
||||
): ResponseInterface {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$fileId = $this->featureContext->getFileIdForPath($user, $path, $spaceId);
|
||||
Assert::assertNotNull(
|
||||
$fileId,
|
||||
__METHOD__
|
||||
. " fileid of file $path user $user not found (the file may not exist)"
|
||||
. " fileid of file $path user $user not found (the file may not exist)",
|
||||
);
|
||||
$index = (int)$index;
|
||||
$response = $this->listVersionFolder($user, $fileId, 1);
|
||||
@@ -458,17 +458,17 @@ class FilesVersionsContext implements Context {
|
||||
$xmlPart = $responseXmlObject->xpath("//d:response/d:href");
|
||||
if (!isset($xmlPart[$index])) {
|
||||
Assert::fail(
|
||||
'could not find version of path "' . $path . '" with index "' . $index . '"'
|
||||
'could not find version of path "' . $path . '" with index "' . $index . '"',
|
||||
);
|
||||
}
|
||||
// the href already contains the path
|
||||
$url = WebDavHelper::sanitizeUrl(
|
||||
$this->featureContext->getBaseUrlWithoutPath() . $xmlPart[$index]
|
||||
$this->featureContext->getBaseUrlWithoutPath() . $xmlPart[$index],
|
||||
);
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user)
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ class FilesVersionsContext implements Context {
|
||||
string $index,
|
||||
string $path,
|
||||
string $user,
|
||||
string $content
|
||||
string $content,
|
||||
): void {
|
||||
$response = $this->downloadVersion($user, $path, $index);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe("200", '', $response);
|
||||
@@ -546,7 +546,7 @@ class FilesVersionsContext implements Context {
|
||||
null,
|
||||
$body,
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
null
|
||||
null,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -567,7 +567,7 @@ class FilesVersionsContext implements Context {
|
||||
string $user,
|
||||
string $fileId,
|
||||
int $folderDepth,
|
||||
?array $properties = null
|
||||
?array $properties = null,
|
||||
): ResponseInterface {
|
||||
if (!$properties) {
|
||||
$properties = [
|
||||
@@ -584,7 +584,7 @@ class FilesVersionsContext implements Context {
|
||||
$properties,
|
||||
(string) $folderDepth,
|
||||
null,
|
||||
"versions"
|
||||
"versions",
|
||||
);
|
||||
return $response;
|
||||
}
|
||||
@@ -609,8 +609,8 @@ class FilesVersionsContext implements Context {
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"versions"
|
||||
)
|
||||
"versions",
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -93,7 +93,7 @@ class NotificationContext implements Context {
|
||||
$this->featureContext->getAdminPassword(),
|
||||
'DELETE',
|
||||
$this->globalNotificationEndpointPath,
|
||||
json_encode($payload)
|
||||
json_encode($payload),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class NotificationContext implements Context {
|
||||
$this->notificationEndpointPath,
|
||||
[],
|
||||
2,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class NotificationContext implements Context {
|
||||
'DELETE',
|
||||
$this->notificationEndpointPath,
|
||||
\json_encode($payload),
|
||||
2
|
||||
2,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ class NotificationContext implements Context {
|
||||
$response = $this->featureContext->getResponse()->getBody()->getContents();
|
||||
throw new \Exception(
|
||||
__METHOD__
|
||||
. " Failed to get user notification list" . $response
|
||||
. " Failed to get user notification list" . $response,
|
||||
);
|
||||
}
|
||||
$notifications = $this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data;
|
||||
@@ -272,7 +272,7 @@ class NotificationContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$numberOfNotification,
|
||||
$actualNumber,
|
||||
"Expected number of notifications was '$numberOfNotification', but got '$actualNumber'"
|
||||
"Expected number of notifications was '$numberOfNotification', but got '$actualNumber'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ class NotificationContext implements Context {
|
||||
*/
|
||||
public function theJsonDataFromLastResponseShouldMatch(
|
||||
string $subject,
|
||||
PyStringNode $schemaString
|
||||
PyStringNode $schemaString,
|
||||
): void {
|
||||
$responseBody = $this->filterResponseAccordingToNotificationSubject($subject);
|
||||
// substitute the value here
|
||||
@@ -302,7 +302,7 @@ class NotificationContext implements Context {
|
||||
);
|
||||
$this->featureContext->assertJsonDocumentMatchesSchema(
|
||||
$responseBody,
|
||||
$this->featureContext->getJSONSchema($schemaString)
|
||||
$this->featureContext->getJSONSchema($schemaString),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ class NotificationContext implements Context {
|
||||
*/
|
||||
public function filterResponseAccordingToNotificationSubject(
|
||||
string $subject,
|
||||
?ResponseInterface $response = null
|
||||
?ResponseInterface $response = null,
|
||||
): object {
|
||||
$response = $response ?? $this->featureContext->getResponse();
|
||||
if (isset($this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data)) {
|
||||
@@ -344,7 +344,7 @@ class NotificationContext implements Context {
|
||||
public function filterNotificationsBySubjectAndResource(
|
||||
string $subject,
|
||||
string $resource,
|
||||
?ResponseInterface $response = null
|
||||
?ResponseInterface $response = null,
|
||||
): array {
|
||||
$filteredNotifications = [];
|
||||
$response = $response ?? $this->featureContext->getResponse();
|
||||
@@ -379,7 +379,7 @@ class NotificationContext implements Context {
|
||||
public function filterNotificationsBySubjectAndSpace(
|
||||
string $subject,
|
||||
string $space,
|
||||
?ResponseInterface $response = null
|
||||
?ResponseInterface $response = null,
|
||||
): array {
|
||||
$filteredNotifications = [];
|
||||
$response = $response ?? $this->featureContext->getResponse();
|
||||
@@ -430,7 +430,7 @@ class NotificationContext implements Context {
|
||||
$actualMessage = str_replace(
|
||||
["\r", "\n"],
|
||||
" ",
|
||||
$this->filterResponseAccordingToNotificationSubject($subject, $response)->message
|
||||
$this->filterResponseAccordingToNotificationSubject($subject, $response)->message,
|
||||
);
|
||||
} else {
|
||||
throw new \Exception("Notification was not found even after retrying for 5 seconds.");
|
||||
@@ -439,7 +439,7 @@ class NotificationContext implements Context {
|
||||
Assert::assertSame(
|
||||
$expectedMessage,
|
||||
$actualMessage,
|
||||
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'"
|
||||
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ class NotificationContext implements Context {
|
||||
string $user,
|
||||
string $resource,
|
||||
string $subject,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$response = $this->listAllNotifications($user);
|
||||
$notification = $this->filterNotificationsBySubjectAndResource($subject, $resource, $response);
|
||||
@@ -469,19 +469,19 @@ class NotificationContext implements Context {
|
||||
Assert::assertSame(
|
||||
$expectedMessage,
|
||||
$actualMessage,
|
||||
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'"
|
||||
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'",
|
||||
);
|
||||
$response = $this->userDeletesNotification($user);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
} elseif (\count($notification) === 0) {
|
||||
throw new \Exception(
|
||||
"Response doesn't contain any notification with resource '$resource' and subject '$subject'.\n"
|
||||
. print_r($notification, true)
|
||||
. print_r($notification, true),
|
||||
);
|
||||
} else {
|
||||
throw new \Exception(
|
||||
"Response contains more than one notification with resource '$resource' and subject '$subject'.\n"
|
||||
. print_r($notification, true)
|
||||
. print_r($notification, true),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -500,7 +500,7 @@ class NotificationContext implements Context {
|
||||
string $user,
|
||||
string $resourceOrSpace,
|
||||
string $resource,
|
||||
string $subject
|
||||
string $subject,
|
||||
): void {
|
||||
$response = $this->listAllNotifications($user);
|
||||
if ($resourceOrSpace === "space") {
|
||||
@@ -512,7 +512,7 @@ class NotificationContext implements Context {
|
||||
0,
|
||||
$filteredResponse,
|
||||
"Response should not contain notification related to resource '$resource' with subject '$subject' but found"
|
||||
. print_r($filteredResponse, true)
|
||||
. print_r($filteredResponse, true),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ class NotificationContext implements Context {
|
||||
public function userCreatesDeprovisioningNotification(
|
||||
?string $user = null,
|
||||
?string $deprovision_date = "2043-07-04T11:23:12Z",
|
||||
?string $deprovision_date_format = "2006-01-02T15:04:05Z07:00"
|
||||
?string $deprovision_date_format = "2006-01-02T15:04:05Z07:00",
|
||||
): ResponseInterface {
|
||||
$payload["type"] = "deprovision";
|
||||
$payload["data"] = [
|
||||
@@ -542,7 +542,7 @@ class NotificationContext implements Context {
|
||||
$user ? $this->featureContext->getPasswordForUser($user) : $this->featureContext->getAdminPassword(),
|
||||
'POST',
|
||||
$this->globalNotificationEndpointPath,
|
||||
json_encode($payload)
|
||||
json_encode($payload),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ class NotificationContext implements Context {
|
||||
*/
|
||||
public function theAdministratorCreatesADeprovisioningNotificationUsingDateFormat(
|
||||
$deprovision_date,
|
||||
$deprovision_date_format
|
||||
$deprovision_date_format,
|
||||
): void {
|
||||
$response = $this->userCreatesDeprovisioningNotification(null, $deprovision_date, $deprovision_date_format);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -610,7 +610,7 @@ class NotificationContext implements Context {
|
||||
$user ? $this->featureContext->getPasswordForUser($user) : $this->featureContext->getAdminPassword(),
|
||||
'DELETE',
|
||||
$this->globalNotificationEndpointPath,
|
||||
json_encode($payload)
|
||||
json_encode($payload),
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class OCSContext implements Context {
|
||||
$verb,
|
||||
$url,
|
||||
null,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ class OCSContext implements Context {
|
||||
string $url,
|
||||
?TableNode $body = null,
|
||||
?string $password = null,
|
||||
?array $headers = null
|
||||
?array $headers = null,
|
||||
): ResponseInterface {
|
||||
/**
|
||||
* array of the data to be sent in the body.
|
||||
@@ -118,7 +118,7 @@ class OCSContext implements Context {
|
||||
$url,
|
||||
$bodyArray,
|
||||
$this->featureContext->getOcsApiVersion(),
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -132,14 +132,14 @@ class OCSContext implements Context {
|
||||
public function adminSendsHttpMethodToOcsApiEndpointWithBody(
|
||||
string $verb,
|
||||
string $url,
|
||||
?TableNode $body
|
||||
?TableNode $body,
|
||||
): ResponseInterface {
|
||||
$admin = $this->featureContext->getAdminUsername();
|
||||
return $this->sendRequestToOcsEndpoint(
|
||||
$admin,
|
||||
$verb,
|
||||
$url,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -153,13 +153,13 @@ class OCSContext implements Context {
|
||||
public function theUserSendsToOcsApiEndpointWithBody(
|
||||
string $verb,
|
||||
string $url,
|
||||
?TableNode $body = null
|
||||
?TableNode $body = null,
|
||||
): ResponseInterface {
|
||||
return $this->sendRequestToOcsEndpoint(
|
||||
$this->featureContext->getCurrentUser(),
|
||||
$verb,
|
||||
$url,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -179,14 +179,14 @@ class OCSContext implements Context {
|
||||
string $verb,
|
||||
string $url,
|
||||
?TableNode $body = null,
|
||||
?string $password = null
|
||||
?string $password = null,
|
||||
): void {
|
||||
$response = $this->sendRequestToOcsEndpoint(
|
||||
$user,
|
||||
$verb,
|
||||
$url,
|
||||
$body,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -204,7 +204,7 @@ class OCSContext implements Context {
|
||||
public function theAdministratorSendsHttpMethodToOcsApiEndpoint(
|
||||
string $verb,
|
||||
string $url,
|
||||
?string $password = null
|
||||
?string $password = null,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendRequestToOcsEndpoint(
|
||||
@@ -212,8 +212,8 @@ class OCSContext implements Context {
|
||||
$verb,
|
||||
$url,
|
||||
null,
|
||||
$password
|
||||
)
|
||||
$password,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ class OCSContext implements Context {
|
||||
string $user,
|
||||
string $verb,
|
||||
string $url,
|
||||
TableNode $headersTable
|
||||
TableNode $headersTable,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$password = $this->featureContext->getPasswordForUser($user);
|
||||
@@ -243,8 +243,8 @@ class OCSContext implements Context {
|
||||
$url,
|
||||
null,
|
||||
$password,
|
||||
$headersTable->getRowsHash()
|
||||
)
|
||||
$headersTable->getRowsHash(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ class OCSContext implements Context {
|
||||
public function administratorSendsToOcsApiEndpointWithHeaders(
|
||||
string $verb,
|
||||
string $url,
|
||||
TableNode $headersTable
|
||||
TableNode $headersTable,
|
||||
): void {
|
||||
$user = $this->featureContext->getAdminUsername();
|
||||
$password = $this->featureContext->getPasswordForUser($user);
|
||||
@@ -272,8 +272,8 @@ class OCSContext implements Context {
|
||||
$url,
|
||||
null,
|
||||
$password,
|
||||
$headersTable->getRowsHash()
|
||||
)
|
||||
$headersTable->getRowsHash(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ class OCSContext implements Context {
|
||||
string $verb,
|
||||
string $url,
|
||||
string $password,
|
||||
TableNode $headersTable
|
||||
TableNode $headersTable,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendRequestToOcsEndpoint(
|
||||
@@ -301,8 +301,8 @@ class OCSContext implements Context {
|
||||
$url,
|
||||
null,
|
||||
$password,
|
||||
$headersTable->getRowsHash()
|
||||
)
|
||||
$headersTable->getRowsHash(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -318,12 +318,12 @@ class OCSContext implements Context {
|
||||
public function theAdministratorSendsHttpMethodToOcsApiEndpointWithBody(
|
||||
string $verb,
|
||||
string $url,
|
||||
?TableNode $body
|
||||
?TableNode $body,
|
||||
): void {
|
||||
$response = $this->adminSendsHttpMethodToOcsApiEndpointWithBody(
|
||||
$verb,
|
||||
$url,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -341,7 +341,7 @@ class OCSContext implements Context {
|
||||
$response = $this->theUserSendsToOcsApiEndpointWithBody(
|
||||
$verb,
|
||||
$url,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -360,7 +360,7 @@ class OCSContext implements Context {
|
||||
string $verb,
|
||||
string $url,
|
||||
string $password,
|
||||
TableNode $body
|
||||
TableNode $body,
|
||||
): void {
|
||||
$admin = $this->featureContext->getAdminUsername();
|
||||
$response = $this->sendRequestToOcsEndpoint(
|
||||
@@ -368,7 +368,7 @@ class OCSContext implements Context {
|
||||
$verb,
|
||||
$url,
|
||||
$body,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -389,14 +389,14 @@ class OCSContext implements Context {
|
||||
string $verb,
|
||||
string $url,
|
||||
string $password,
|
||||
TableNode $body
|
||||
TableNode $body,
|
||||
): void {
|
||||
$response = $this->sendRequestToOcsEndpoint(
|
||||
$user,
|
||||
$verb,
|
||||
$url,
|
||||
$body,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -414,12 +414,12 @@ class OCSContext implements Context {
|
||||
public function theOCSStatusCodeShouldBe(
|
||||
string $statusCode,
|
||||
string $message = "",
|
||||
?ResponseInterface $response = null
|
||||
?ResponseInterface $response = null,
|
||||
): void {
|
||||
$statusCodes = explode(",", $statusCode);
|
||||
$response = $response ?? $this->featureContext->getResponse();
|
||||
$responseStatusCode = $this->getOCSResponseStatusCode(
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
if (\is_array($statusCodes)) {
|
||||
if ($message === "") {
|
||||
@@ -429,7 +429,7 @@ class OCSContext implements Context {
|
||||
Assert::assertContainsEquals(
|
||||
$responseStatusCode,
|
||||
$statusCodes,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
$this->featureContext->emptyLastOCSStatusCodesArray();
|
||||
} else {
|
||||
@@ -440,7 +440,7 @@ class OCSContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$statusCodes,
|
||||
$responseStatusCode,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -458,13 +458,13 @@ class OCSContext implements Context {
|
||||
$statusCodes = [$statusCode1,$statusCode1];
|
||||
$response = $this->featureContext->getResponse();
|
||||
$responseStatusCode = $this->getOCSResponseStatusCode(
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
Assert::assertContainsEquals(
|
||||
$responseStatusCode,
|
||||
$statusCodes,
|
||||
"OCS status code is not any of the expected values "
|
||||
. \implode(",", $statusCodes) . " got " . $responseStatusCode
|
||||
. \implode(",", $statusCodes) . " got " . $responseStatusCode,
|
||||
);
|
||||
$this->featureContext->emptyLastOCSStatusCodesArray();
|
||||
}
|
||||
@@ -487,11 +487,11 @@ class OCSContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$statusMessage,
|
||||
$this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
$this->featureContext->getResponse(),
|
||||
),
|
||||
'Unexpected OCS status message :"' . $this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
) . '" in response'
|
||||
$this->featureContext->getResponse(),
|
||||
) . '" in response',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -509,16 +509,16 @@ class OCSContext implements Context {
|
||||
$user = \strtolower($this->featureContext->getActualUsername($user));
|
||||
$statusMessage = $this->featureContext->substituteInLineCodes(
|
||||
$statusMessage,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
Assert::assertEquals(
|
||||
$statusMessage,
|
||||
$this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
$this->featureContext->getResponse(),
|
||||
),
|
||||
'Unexpected OCS status message :"' . $this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
) . '" in response'
|
||||
$this->featureContext->getResponse(),
|
||||
) . '" in response',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -541,16 +541,16 @@ class OCSContext implements Context {
|
||||
* @return void
|
||||
*/
|
||||
public function theOCSStatusMessageShouldBePyString(
|
||||
PyStringNode $statusMessage
|
||||
PyStringNode $statusMessage,
|
||||
): void {
|
||||
Assert::assertEquals(
|
||||
$statusMessage->getRaw(),
|
||||
$this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
$this->featureContext->getResponse(),
|
||||
),
|
||||
'Unexpected OCS status message: "' . $this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
) . '" in response'
|
||||
$this->featureContext->getResponse(),
|
||||
) . '" in response',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -621,7 +621,7 @@ class OCSContext implements Context {
|
||||
if ($language !== null) {
|
||||
$multiLingualMessage = \json_decode(
|
||||
\file_get_contents(__DIR__ . "/../fixtures/multiLanguageErrors.json"),
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
if (isset($multiLingualMessage[$statusMessage][$language])) {
|
||||
@@ -643,7 +643,7 @@ class OCSContext implements Context {
|
||||
*/
|
||||
public function assertOCSResponseIndicatesSuccess(
|
||||
?string $message = "",
|
||||
?ResponseInterface $response = null
|
||||
?ResponseInterface $response = null,
|
||||
): void {
|
||||
$response = $response ?? $this->featureContext->getResponse();
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe('200', $message, $response);
|
||||
|
||||
@@ -68,7 +68,7 @@ class OcisConfigContext implements Context {
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to set async upload with delayed post processing"
|
||||
"Failed to set async upload with delayed post processing",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class OcisConfigContext implements Context {
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to set config $configVariable=$configValue"
|
||||
"Failed to set config $configVariable=$configValue",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ class OcisConfigContext implements Context {
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to enable role $role"
|
||||
"Failed to enable role $role",
|
||||
);
|
||||
$this->setEnabledPermissionsRoles($defaultRoles);
|
||||
}
|
||||
@@ -141,7 +141,7 @@ class OcisConfigContext implements Context {
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to disable role $role"
|
||||
"Failed to disable role $role",
|
||||
);
|
||||
$this->setEnabledPermissionsRoles($availableRoles);
|
||||
}
|
||||
@@ -160,12 +160,12 @@ class OcisConfigContext implements Context {
|
||||
$response = OcisConfigHelper::reConfigureOcis(
|
||||
[
|
||||
$configVariable => $path,
|
||||
]
|
||||
],
|
||||
);
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to set config $configVariable=$path"
|
||||
"Failed to set config $configVariable=$path",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ class OcisConfigContext implements Context {
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to set config"
|
||||
"Failed to set config",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ class OcisConfigContext implements Context {
|
||||
*/
|
||||
public function theAdministratorHasStartedServiceSeparatelyWithTheFollowingConfig(
|
||||
string $service,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$envs = [];
|
||||
foreach ($table->getHash() as $row) {
|
||||
@@ -213,7 +213,7 @@ class OcisConfigContext implements Context {
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to start service $service."
|
||||
"Failed to start service $service.",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ class OcisConfigContext implements Context {
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to rollback ocis server. Check if oCIS is started with ociswrapper."
|
||||
"Failed to rollback ocis server. Check if oCIS is started with ociswrapper.",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ class OcisConfigContext implements Context {
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to rollback services."
|
||||
"Failed to rollback services.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class OcmContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$email,
|
||||
$description
|
||||
$description,
|
||||
);
|
||||
$responseData = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
|
||||
if (isset($responseData["token"])) {
|
||||
@@ -142,7 +142,7 @@ class OcmContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$token ? $token : $this->getLastFederatedInvitationToken(),
|
||||
$providerDomain
|
||||
$providerDomain,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -201,8 +201,8 @@ class OcmContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$token,
|
||||
$providerDomain
|
||||
)
|
||||
$providerDomain,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ class OcmContext implements Context {
|
||||
$response = OcmHelper::findAcceptedUsers(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user)
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
);
|
||||
if ($response->getStatusCode() === 200) {
|
||||
$users = $this->featureContext->getJsonDecodedResponse($response);
|
||||
@@ -261,7 +261,7 @@ class OcmContext implements Context {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
200,
|
||||
"failed to list accepted users by '$user'",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
$users = ($this->featureContext->getJsonDecodedResponse($response));
|
||||
foreach ($users as $acceptedUser) {
|
||||
@@ -282,7 +282,7 @@ class OcmContext implements Context {
|
||||
return OcmHelper::listInvite(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user)
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ class OcmContext implements Context {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
200,
|
||||
"failed while deleting connection with user $ocmUser",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ class OcmContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$ocmUser['user_id'],
|
||||
$ocmUser['idp']
|
||||
$ocmUser['idp'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -395,12 +395,12 @@ class OcmContext implements Context {
|
||||
$response = HttpRequestHelper::get(
|
||||
$this->archiverContext->getArchiverUrl($queryString),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user)
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
200,
|
||||
"Failed to download archive of resource $resource",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ class OcmContext implements Context {
|
||||
public function userSendsPropfindRequestToFederatedShareWithDepthUsingTheWebdavApi(
|
||||
string $user,
|
||||
string $share,
|
||||
string $folderDepth
|
||||
string $folderDepth,
|
||||
): void {
|
||||
$response = $this->spacesContext->sendPropfindRequestToSpace($user, "", $share, null, $folderDepth, true);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -462,7 +462,7 @@ class OcmContext implements Context {
|
||||
public function userDeletesFederatedConnectionWithUserAndProviderUsingTheGraphApi(
|
||||
string $user,
|
||||
string $ocmUser,
|
||||
string $idp
|
||||
string $idp,
|
||||
): void {
|
||||
$this->featureContext->setResponse($this->deleteConnection($user, $ocmUser, $idp));
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ trait Provisioning {
|
||||
return $usersList[$normalizedUsername][$attribute];
|
||||
}
|
||||
throw new Exception(
|
||||
__METHOD__ . ": User '$user' has no attribute with name '$attribute'."
|
||||
__METHOD__ . ": User '$user' has no attribute with name '$attribute'.",
|
||||
);
|
||||
}
|
||||
return false;
|
||||
@@ -139,7 +139,7 @@ trait Provisioning {
|
||||
return $groupsList[$group][$attribute];
|
||||
}
|
||||
throw new Exception(
|
||||
__METHOD__ . ": Group '$group' has no attribute with name '$attribute'."
|
||||
__METHOD__ . ": Group '$group' has no attribute with name '$attribute'.",
|
||||
);
|
||||
}
|
||||
return false;
|
||||
@@ -160,7 +160,7 @@ trait Provisioning {
|
||||
$password = $this->createdUsers[$normalizedUsername]['password'];
|
||||
} else {
|
||||
throw new Exception(
|
||||
"user '$username' was not created by this test run"
|
||||
"user '$username' was not created by this test run",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ trait Provisioning {
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
public function userHasBeenCreatedWithDefaultAttributes(
|
||||
string $user
|
||||
string $user,
|
||||
): void {
|
||||
$this->userHasBeenCreated(["userName" => $user]);
|
||||
}
|
||||
@@ -191,7 +191,7 @@ trait Provisioning {
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
public function userHasBeenCreatedWithDefaultAttributesAndNotInitialized(
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$this->usersHaveBeenCreated($table, true, false);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ trait Provisioning {
|
||||
$rows = $table->getRowsHash();
|
||||
$this->userHasBeenCreated(
|
||||
$rows,
|
||||
$byUser
|
||||
$byUser,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ trait Provisioning {
|
||||
|
||||
throw new Exception(
|
||||
__METHOD__
|
||||
. " group '$groupname' was not created by this test run"
|
||||
. " group '$groupname' was not created by this test run",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ trait Provisioning {
|
||||
"uid=" . ldap_escape(
|
||||
$entry['uid'],
|
||||
"",
|
||||
LDAP_ESCAPE_DN
|
||||
LDAP_ESCAPE_DN,
|
||||
) . ",ou=" . $this->ldapUsersOU . "," . $this->ldapBaseDN,
|
||||
);
|
||||
OcisHelper::deleteRevaUserData([$entry['uid']]);
|
||||
@@ -514,12 +514,12 @@ trait Provisioning {
|
||||
// delete all created ldap users
|
||||
$this->ldap->delete(
|
||||
"ou=" . $this->ldapUsersOU . "," . $this->ldapBaseDN,
|
||||
true
|
||||
true,
|
||||
);
|
||||
// delete all created ldap groups
|
||||
$this->ldap->delete(
|
||||
"ou=" . $this->ldapGroupsOU . "," . $this->ldapBaseDN,
|
||||
true
|
||||
true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -541,7 +541,7 @@ trait Provisioning {
|
||||
public function usersHaveBeenCreated(
|
||||
TableNode $table,
|
||||
bool $useDefault = true,
|
||||
bool $initialize = true
|
||||
bool $initialize = true,
|
||||
): void {
|
||||
$this->verifyTableNodeColumns($table, ['username'], ['displayname', 'email', 'password']);
|
||||
$table = $table->getColumnsHash();
|
||||
@@ -550,7 +550,7 @@ trait Provisioning {
|
||||
$requests = [];
|
||||
$client = HttpRequestHelper::createClient(
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword()
|
||||
$this->getAdminPassword(),
|
||||
);
|
||||
|
||||
foreach ($users as $userAttributes) {
|
||||
@@ -564,7 +564,7 @@ trait Provisioning {
|
||||
Assert::assertArrayHasKey(
|
||||
'userid',
|
||||
$userAttributes,
|
||||
__METHOD__ . " userAttributes array does not have key 'userid'"
|
||||
__METHOD__ . " userAttributes array does not have key 'userid'",
|
||||
);
|
||||
$attributesToCreateUser['email'] = $userAttributes['userid'] . '@owncloud.com';
|
||||
} else {
|
||||
@@ -574,7 +574,7 @@ trait Provisioning {
|
||||
$attributesToCreateUser['userid'],
|
||||
$attributesToCreateUser['password'],
|
||||
$attributesToCreateUser['email'],
|
||||
$attributesToCreateUser['displayname']
|
||||
$attributesToCreateUser['displayname'],
|
||||
);
|
||||
$request = GraphHelper::createRequest(
|
||||
$this->getBaseUrl(),
|
||||
@@ -603,7 +603,7 @@ trait Provisioning {
|
||||
$users[$key]['userid'] . "'" .
|
||||
"\nHTTP status $httpStatusCode " .
|
||||
"\nGraph status $graphStatusCode " .
|
||||
"\nError message $messageText"
|
||||
"\nError message $messageText",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -625,7 +625,7 @@ trait Provisioning {
|
||||
$userAttributes['password'],
|
||||
$userAttributes['displayName'],
|
||||
$userAttributes['email'],
|
||||
$userAttributes['id']
|
||||
$userAttributes['id'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ trait Provisioning {
|
||||
foreach ($users as $user) {
|
||||
Assert::assertTrue(
|
||||
$this->userExists($user["userid"]),
|
||||
"User '" . $user["userid"] . "' should exist but does not exist"
|
||||
"User '" . $user["userid"] . "' should exist but does not exist",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -657,7 +657,7 @@ trait Provisioning {
|
||||
$this->userResetUserPasswordUsingProvisioningApi(
|
||||
$this->getAdminUsername(),
|
||||
$username,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -671,14 +671,14 @@ trait Provisioning {
|
||||
public function userResetUserPasswordUsingProvisioningApi(
|
||||
?string $user,
|
||||
?string $username,
|
||||
?string $password
|
||||
?string $password,
|
||||
): void {
|
||||
$targetUsername = $this->getActualUsername($username);
|
||||
$password = $this->getActualPassword($password);
|
||||
$this->userTriesToResetUserPasswordUsingTheProvisioningApi(
|
||||
$user,
|
||||
$targetUsername,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$this->rememberUserPassword($targetUsername, $password);
|
||||
}
|
||||
@@ -693,7 +693,7 @@ trait Provisioning {
|
||||
public function userTriesToResetUserPasswordUsingTheProvisioningApi(
|
||||
?string $user,
|
||||
?string $username,
|
||||
?string $password
|
||||
?string $password,
|
||||
): void {
|
||||
$password = $this->getActualPassword($password);
|
||||
$bodyTable = new TableNode([['key', 'password'], ['value', $password]]);
|
||||
@@ -701,7 +701,7 @@ trait Provisioning {
|
||||
$user,
|
||||
"PUT",
|
||||
"/cloud/users/$username",
|
||||
$bodyTable
|
||||
$bodyTable,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -730,7 +730,7 @@ trait Provisioning {
|
||||
public function userShouldExist(string $user): void {
|
||||
Assert::assertTrue(
|
||||
$this->userExists($user),
|
||||
"User '$user' should exist but does not exist"
|
||||
"User '$user' should exist but does not exist",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ trait Provisioning {
|
||||
$user = $this->getActualUsername($user);
|
||||
Assert::assertFalse(
|
||||
$this->userExists($user),
|
||||
"User '$user' should not exist but does exist"
|
||||
"User '$user' should not exist but does exist",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -762,7 +762,7 @@ trait Provisioning {
|
||||
public function groupShouldExist(string $group): void {
|
||||
Assert::assertTrue(
|
||||
$this->groupExists($group),
|
||||
"Group '$group' should exist but does not exist"
|
||||
"Group '$group' should exist but does not exist",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ trait Provisioning {
|
||||
public function groupShouldNotExist(string $group): void {
|
||||
Assert::assertFalse(
|
||||
$this->groupExists($group),
|
||||
"Group '$group' should not exist but does exist"
|
||||
"Group '$group' should not exist but does exist",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -802,7 +802,7 @@ trait Provisioning {
|
||||
throw new Exception(
|
||||
"group '" . $row['groupname'] .
|
||||
"' does" . ($should ? " not" : "") .
|
||||
" exist but should" . ($should ? "" : " not")
|
||||
" exist but should" . ($should ? "" : " not"),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -832,7 +832,7 @@ trait Provisioning {
|
||||
}
|
||||
Assert::assertFalse(
|
||||
$this->userExists($user),
|
||||
"User '$user' should not exist but does exist"
|
||||
"User '$user' should not exist but does exist",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -854,7 +854,7 @@ trait Provisioning {
|
||||
}
|
||||
$this->initializeUser(
|
||||
$row ['username'],
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -869,7 +869,7 @@ trait Provisioning {
|
||||
return HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword()
|
||||
$this->getAdminPassword(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -887,7 +887,7 @@ trait Provisioning {
|
||||
$this->response = HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$actualUser,
|
||||
$actualPassword
|
||||
$actualPassword,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -901,7 +901,7 @@ trait Provisioning {
|
||||
*/
|
||||
public function userGetsTheListOfAllUsersUsingTheProvisioningApi(string $user): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->userGetsTheListOfAllUsers($user)
|
||||
$this->userGetsTheListOfAllUsers($user),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -917,7 +917,7 @@ trait Provisioning {
|
||||
return HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$actualUser,
|
||||
$actualPassword
|
||||
$actualPassword,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -936,7 +936,7 @@ trait Provisioning {
|
||||
HttpRequestHelper::get(
|
||||
$url,
|
||||
$user,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -968,7 +968,7 @@ trait Provisioning {
|
||||
?string $displayName = null,
|
||||
?string $email = null,
|
||||
?string $userId = null,
|
||||
bool $shouldExist = true
|
||||
bool $shouldExist = true,
|
||||
): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$normalizedUsername = $this->normalizeUsername($user);
|
||||
@@ -997,7 +997,7 @@ trait Provisioning {
|
||||
*/
|
||||
public function rememberUserPassword(
|
||||
string $user,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$normalizedUsername = $this->normalizeUsername($user);
|
||||
if (\array_key_exists($normalizedUsername, $this->createdUsers)) {
|
||||
@@ -1055,7 +1055,7 @@ trait Provisioning {
|
||||
*/
|
||||
public function userHasBeenCreated(
|
||||
array $userData,
|
||||
string $byUser = null
|
||||
string $byUser = null,
|
||||
): void {
|
||||
$userId = null;
|
||||
|
||||
@@ -1095,7 +1095,7 @@ trait Provisioning {
|
||||
$this->createLdapUser($setting);
|
||||
} catch (LdapException $exception) {
|
||||
throw new Exception(
|
||||
__METHOD__ . " cannot create a LDAP user with provided data. Error: $exception"
|
||||
__METHOD__ . " cannot create a LDAP user with provided data. Error: $exception",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -1113,7 +1113,7 @@ trait Provisioning {
|
||||
201,
|
||||
$response->getStatusCode(),
|
||||
__METHOD__ . " cannot create user '$user' using Graph API.\nResponse:" .
|
||||
json_encode($this->getJsonDecodedResponse($response))
|
||||
json_encode($this->getJsonDecodedResponse($response)),
|
||||
);
|
||||
$userId = $this->getJsonDecodedResponse($response)['id'];
|
||||
}
|
||||
@@ -1122,7 +1122,7 @@ trait Provisioning {
|
||||
|
||||
Assert::assertTrue(
|
||||
$this->userExists($user),
|
||||
"User '$user' should exist but does not exist"
|
||||
"User '$user' should exist but does not exist",
|
||||
);
|
||||
|
||||
$this->initializeUser($user, $password);
|
||||
@@ -1146,14 +1146,14 @@ trait Provisioning {
|
||||
$group,
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword(),
|
||||
$this->ocsApiVersion
|
||||
$this->ocsApiVersion,
|
||||
);
|
||||
} else {
|
||||
$this->setResponse(
|
||||
$this->graphContext->removeUserFromGroup(
|
||||
$group,
|
||||
$user
|
||||
)
|
||||
$user,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1179,7 +1179,7 @@ trait Provisioning {
|
||||
$expectedGroups,
|
||||
$respondedArray,
|
||||
__METHOD__
|
||||
. " Provided groups do not match the groups returned in the response."
|
||||
. " Provided groups do not match the groups returned in the response.",
|
||||
);
|
||||
} else {
|
||||
$this->graphContext->theseGroupsShouldBeInTheResponse($groupsSimplified);
|
||||
@@ -1207,7 +1207,7 @@ trait Provisioning {
|
||||
} catch (Exception $e) {
|
||||
\error_log(
|
||||
"INFORMATION: There was an unexpected problem trying to delete group " .
|
||||
"'$group' message '" . $e->getMessage() . "'"
|
||||
"'$group' message '" . $e->getMessage() . "'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1217,7 +1217,7 @@ trait Provisioning {
|
||||
\error_log(
|
||||
"INFORMATION: tried to delete group '$group'" .
|
||||
" at the end of the scenario but it seems to still exist. " .
|
||||
"There might be problems with later scenarios."
|
||||
"There might be problems with later scenarios.",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1245,7 +1245,7 @@ trait Provisioning {
|
||||
$response = HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$requestingUser,
|
||||
$requestingPassword
|
||||
$requestingPassword,
|
||||
);
|
||||
if ($response->getStatusCode() >= 400) {
|
||||
return false;
|
||||
@@ -1273,7 +1273,7 @@ trait Provisioning {
|
||||
$respondedArray,
|
||||
__METHOD__ . " Group '$group' does not exist in '"
|
||||
. \implode(', ', $respondedArray)
|
||||
. "'"
|
||||
. "'",
|
||||
);
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
@@ -1281,12 +1281,12 @@ trait Provisioning {
|
||||
__METHOD__
|
||||
. " Expected status code is '200' but got '"
|
||||
. $this->response->getStatusCode()
|
||||
. "'"
|
||||
. "'",
|
||||
);
|
||||
} else {
|
||||
$this->graphContext->userShouldBeMemberInGroupUsingTheGraphApi(
|
||||
$user,
|
||||
$group
|
||||
$group,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1310,14 +1310,14 @@ trait Provisioning {
|
||||
$response = HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword()
|
||||
$this->getAdminPassword(),
|
||||
);
|
||||
$respondedArray = $this->getArrayOfGroupsResponded($response);
|
||||
\sort($respondedArray);
|
||||
Assert::assertNotContains($group, $respondedArray);
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode()
|
||||
$response->getStatusCode(),
|
||||
);
|
||||
} else {
|
||||
$this->graphContext->userShouldNotBeMemberInGroupUsingTheGraphApi($user, $group);
|
||||
@@ -1339,7 +1339,7 @@ trait Provisioning {
|
||||
$response = HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword()
|
||||
$this->getAdminPassword(),
|
||||
);
|
||||
Assert::assertNotContains($username, $this->getArrayOfUsersResponded($response));
|
||||
}
|
||||
@@ -1373,11 +1373,11 @@ trait Provisioning {
|
||||
try {
|
||||
$this->addUserToLdapGroup(
|
||||
$user,
|
||||
$group
|
||||
$group,
|
||||
);
|
||||
} catch (LdapException $exception) {
|
||||
throw new Exception(
|
||||
"User $user cannot be added to $group Error: $exception"
|
||||
"User $user cannot be added to $group Error: $exception",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -1404,11 +1404,11 @@ trait Provisioning {
|
||||
try {
|
||||
$this->addUserToLdapGroup(
|
||||
$user,
|
||||
$group
|
||||
$group,
|
||||
);
|
||||
} catch (LdapException $exception) {
|
||||
throw new Exception(
|
||||
"User $user cannot be added to $group Error: $exception"
|
||||
"User $user cannot be added to $group Error: $exception",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -1430,7 +1430,7 @@ trait Provisioning {
|
||||
string $group,
|
||||
bool $shouldExist = true,
|
||||
bool $possibleToDelete = true,
|
||||
?string $id = null
|
||||
?string $id = null,
|
||||
): void {
|
||||
$groupData = [
|
||||
"shouldExist" => $shouldExist,
|
||||
@@ -1477,7 +1477,7 @@ trait Provisioning {
|
||||
$this->createTheGroup($group);
|
||||
Assert::assertTrue(
|
||||
$this->groupExists($group),
|
||||
"Group '$group' should exist but does not exist"
|
||||
"Group '$group' should exist but does not exist",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1523,7 +1523,7 @@ trait Provisioning {
|
||||
$this->createLdapGroup($group);
|
||||
} catch (LdapException $e) {
|
||||
throw new Exception(
|
||||
"could not create group '$group'. Error: $e"
|
||||
"could not create group '$group'. Error: $e",
|
||||
);
|
||||
}
|
||||
break;
|
||||
@@ -1537,7 +1537,7 @@ trait Provisioning {
|
||||
break;
|
||||
default:
|
||||
throw new InvalidArgumentException(
|
||||
"Invalid method to create group '$group'"
|
||||
"Invalid method to create group '$group'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1557,7 +1557,7 @@ trait Provisioning {
|
||||
string $attribute,
|
||||
string $entry,
|
||||
string $value,
|
||||
bool $append = false
|
||||
bool $append = false,
|
||||
): void {
|
||||
$ldapEntry = $this->ldap->getEntry($entry . "," . $this->ldapBaseDN);
|
||||
Laminas\Ldap\Attribute::setAttribute($ldapEntry, $attribute, $value, $append);
|
||||
@@ -1588,7 +1588,7 @@ trait Provisioning {
|
||||
$memberAttr,
|
||||
"cn=$group,ou=$ou",
|
||||
$memberValue,
|
||||
true
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1602,7 +1602,7 @@ trait Provisioning {
|
||||
public function deleteValueFromLdapAttribute(string $value, string $attribute, string $entry): void {
|
||||
$this->ldap->deleteAttributes(
|
||||
$entry . "," . $this->ldapBaseDN,
|
||||
[$attribute => [$value]]
|
||||
[$attribute => [$value]],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1629,7 +1629,7 @@ trait Provisioning {
|
||||
$this->deleteValueFromLdapAttribute(
|
||||
$memberValue,
|
||||
$memberAttr,
|
||||
"cn=$group,ou=$ou"
|
||||
"cn=$group,ou=$ou",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1673,7 +1673,7 @@ trait Provisioning {
|
||||
public function deleteLdapUser(?string $username, ?string $ou = null): void {
|
||||
if (!\in_array($username, $this->ldapCreatedUsers)) {
|
||||
throw new Error(
|
||||
"User " . $username . " was not created using Ldap and does not exist as an Ldap User"
|
||||
"User " . $username . " was not created using Ldap and does not exist as an Ldap User",
|
||||
);
|
||||
}
|
||||
if ($ou === null) {
|
||||
@@ -1708,7 +1708,7 @@ trait Provisioning {
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
Assert::assertEquals(
|
||||
@@ -1734,7 +1734,7 @@ trait Provisioning {
|
||||
$user,
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword(),
|
||||
$this->ocsApiVersion
|
||||
$this->ocsApiVersion,
|
||||
);
|
||||
} else {
|
||||
// users can be deleted using the username in the GraphApi too
|
||||
@@ -1765,7 +1765,7 @@ trait Provisioning {
|
||||
$this->rememberThatGroupIsNotExpectedToExist($group);
|
||||
Assert::assertFalse(
|
||||
$this->groupExists($group),
|
||||
"Group '$group' should not exist but does exist"
|
||||
"Group '$group' should not exist but does exist",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1790,7 +1790,7 @@ trait Provisioning {
|
||||
$this->response = HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword()
|
||||
$this->getAdminPassword(),
|
||||
);
|
||||
if ($this->response->getStatusCode() >= 400) {
|
||||
return false;
|
||||
@@ -1824,14 +1824,14 @@ trait Provisioning {
|
||||
$response = HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword()
|
||||
$this->getAdminPassword(),
|
||||
);
|
||||
$respondedArray = $this->getArrayOfGroupsResponded($response);
|
||||
\sort($respondedArray);
|
||||
Assert::assertNotContains($group, $respondedArray);
|
||||
Assert::assertEquals(
|
||||
200,
|
||||
$response->getStatusCode()
|
||||
$response->getStatusCode(),
|
||||
);
|
||||
} else {
|
||||
$this->graphContext->userShouldNotBeMemberInGroupUsingTheGraphApi($user, $group);
|
||||
@@ -1853,7 +1853,7 @@ trait Provisioning {
|
||||
function ($user) {
|
||||
return $this->getActualUsername($user);
|
||||
},
|
||||
$this->simplifyArray($users)
|
||||
$this->simplifyArray($users),
|
||||
);
|
||||
if ($this->isTestingWithLdap()) {
|
||||
$respondedArray = $this->getArrayOfUsersResponded($this->response);
|
||||
@@ -1861,7 +1861,7 @@ trait Provisioning {
|
||||
$usersSimplified,
|
||||
$respondedArray,
|
||||
__METHOD__
|
||||
. " Provided users do not match the users returned in the response."
|
||||
. " Provided users do not match the users returned in the response.",
|
||||
);
|
||||
} else {
|
||||
$this->graphContext->theseUsersShouldBeInTheResponse($usersSimplified);
|
||||
@@ -1918,7 +1918,7 @@ trait Provisioning {
|
||||
$responseData = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0];
|
||||
Assert::assertEmpty(
|
||||
$responseData,
|
||||
"Response data is not empty but it should be empty"
|
||||
"Response data is not empty but it should be empty",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1959,7 +1959,7 @@ trait Provisioning {
|
||||
$this->theHTTPStatusCodeShouldBe(204, "Failed to delete user '$user'", $response);
|
||||
Assert::assertFalse(
|
||||
$this->userExists($user),
|
||||
"User '$user' should not exist but does exist"
|
||||
"User '$user' should not exist but does exist",
|
||||
);
|
||||
}
|
||||
$this->usingServer($previousServer);
|
||||
@@ -2026,7 +2026,7 @@ trait Provisioning {
|
||||
return HttpRequestHelper::put(
|
||||
$fullUrl,
|
||||
$actualUser,
|
||||
$actualPassword
|
||||
$actualPassword,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class PublicWebDavContext implements Context {
|
||||
return $this->downloadFileFromPublicFolder(
|
||||
$path,
|
||||
$password,
|
||||
$range
|
||||
$range,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function userTriesToDownloadFileFromPublicLinkUsingBasicAuthAndPublicWebdav(
|
||||
string $user,
|
||||
string $path
|
||||
string $path,
|
||||
): void {
|
||||
$response = $this->downloadFromPublicLinkAsUser($path, $user);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -108,10 +108,10 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
*/
|
||||
public function thePublicDeletesFileFolderFromTheLastPublicLinkShareUsingThePublicWebdavApi(
|
||||
string $fileName
|
||||
string $fileName,
|
||||
): void {
|
||||
$response = $this->deleteFileFromPublicShare(
|
||||
$fileName
|
||||
$fileName,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
@@ -130,13 +130,13 @@ class PublicWebDavContext implements Context {
|
||||
$davPath = WebDavHelper::getDavPath(
|
||||
WebDavHelper::DAV_VERSION_NEW,
|
||||
$token,
|
||||
"public-files"
|
||||
"public-files",
|
||||
);
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileName";
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$headers = [
|
||||
'X-Requested-With' => 'XMLHttpRequest',
|
||||
@@ -145,7 +145,7 @@ class PublicWebDavContext implements Context {
|
||||
$fullUrl,
|
||||
$userName,
|
||||
$password,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function thePublicHasDeletedFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(
|
||||
string $file,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$response = $this->deleteFileFromPublicShare($file, $password);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
||||
@@ -175,10 +175,10 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function thePublicDeletesFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(
|
||||
string $file,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->deleteFileFromPublicShare($file, $password)
|
||||
$this->deleteFileFromPublicShare($file, $password),
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class PublicWebDavContext implements Context {
|
||||
public function renameFileFromPublicShare(
|
||||
string $fileName,
|
||||
string $toFileName,
|
||||
?string $password = ""
|
||||
?string $password = "",
|
||||
): ResponseInterface {
|
||||
$token = ($this->featureContext->isUsingSharingNG())
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
@@ -201,14 +201,14 @@ class PublicWebDavContext implements Context {
|
||||
$davPath = WebDavHelper::getDavPath(
|
||||
WebDavHelper::DAV_VERSION_NEW,
|
||||
$token,
|
||||
"public-files"
|
||||
"public-files",
|
||||
);
|
||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileName";
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
$destination = $this->featureContext->getBaseUrl() . "/$davPath/$toFileName";
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$headers = [
|
||||
'X-Requested-With' => 'XMLHttpRequest',
|
||||
@@ -219,7 +219,7 @@ class PublicWebDavContext implements Context {
|
||||
"MOVE",
|
||||
$userName,
|
||||
$password,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -235,10 +235,10 @@ class PublicWebDavContext implements Context {
|
||||
public function thePublicRenamesFileFromTheLastPublicShareUsingThePasswordPasswordAndOldPublicWebdavApi(
|
||||
string $fileName,
|
||||
string $toName,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->renameFileFromPublicShare($fileName, $toName, $password)
|
||||
$this->renameFileFromPublicShare($fileName, $toName, $password),
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
@@ -254,13 +254,13 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function publicDownloadsFileFromInsideLastPublicSharedFolderWithPassword(
|
||||
string $path,
|
||||
string $password = ""
|
||||
string $password = "",
|
||||
): void {
|
||||
$response = $this->downloadFileFromPublicFolder(
|
||||
$path,
|
||||
$password,
|
||||
"",
|
||||
$this->featureContext->isUsingSharingNG()
|
||||
$this->featureContext->isUsingSharingNG(),
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -280,7 +280,7 @@ class PublicWebDavContext implements Context {
|
||||
$davPath = WebDavHelper::getDavPath(
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
$token,
|
||||
"public-files"
|
||||
"public-files",
|
||||
);
|
||||
|
||||
$username = $this->featureContext->getActualUsername($user);
|
||||
@@ -290,7 +290,7 @@ class PublicWebDavContext implements Context {
|
||||
return HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$username,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
}
|
||||
/**
|
||||
@@ -305,7 +305,7 @@ class PublicWebDavContext implements Context {
|
||||
string $path,
|
||||
string $password,
|
||||
string $range,
|
||||
bool $shareNg = false
|
||||
bool $shareNg = false,
|
||||
): ResponseInterface {
|
||||
$path = \ltrim($path, "/");
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
@@ -317,12 +317,12 @@ class PublicWebDavContext implements Context {
|
||||
$davPath = WebDavHelper::getDavPath(
|
||||
WebDavHelper::DAV_VERSION_NEW,
|
||||
$token,
|
||||
"public-files"
|
||||
"public-files",
|
||||
);
|
||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$path";
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
|
||||
$headers = [
|
||||
@@ -335,7 +335,7 @@ class PublicWebDavContext implements Context {
|
||||
$fullUrl,
|
||||
$userName,
|
||||
$password,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ class PublicWebDavContext implements Context {
|
||||
return $this->publicUploadContent(
|
||||
\basename($source),
|
||||
'',
|
||||
\file_get_contents($source)
|
||||
\file_get_contents($source),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -367,11 +367,11 @@ class PublicWebDavContext implements Context {
|
||||
public function publiclyCopyingFile(
|
||||
string $baseUrl,
|
||||
string $source,
|
||||
string $destination
|
||||
string $destination,
|
||||
): ResponseInterface {
|
||||
$fullSourceUrl = "$baseUrl/$source";
|
||||
$fullDestUrl = WebDavHelper::sanitizeUrl(
|
||||
"$baseUrl/$destination"
|
||||
"$baseUrl/$destination",
|
||||
);
|
||||
|
||||
$headers["Destination"] = $fullDestUrl;
|
||||
@@ -380,7 +380,7 @@ class PublicWebDavContext implements Context {
|
||||
"COPY",
|
||||
null,
|
||||
null,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -399,14 +399,14 @@ class PublicWebDavContext implements Context {
|
||||
$davPath = WebDavHelper::getDavPath(
|
||||
WebDavHelper::DAV_VERSION_NEW,
|
||||
$token,
|
||||
"public-files"
|
||||
"public-files",
|
||||
);
|
||||
$baseUrl = $this->featureContext->getLocalBaseUrl() . '/' . $davPath;
|
||||
|
||||
$response = $this->publiclyCopyingFile(
|
||||
$baseUrl,
|
||||
$source,
|
||||
$destination
|
||||
$destination,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -447,7 +447,7 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function thePublicHasUploadedFileWithContentWithAutoRenameMode(
|
||||
string $filename,
|
||||
string $body = 'test'
|
||||
string $body = 'test',
|
||||
): void {
|
||||
$response = $this->publiclyUploadingContentAutoRename($filename, $body);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
||||
@@ -486,7 +486,7 @@ class PublicWebDavContext implements Context {
|
||||
public function thePublicHasUploadedFileWithContentAndPasswordToLastLinkShareUsingPublicWebdavApi(
|
||||
string $filename,
|
||||
string $content = 'test',
|
||||
string $password = ''
|
||||
string $password = '',
|
||||
): void {
|
||||
$response = $this->publiclyUploadingContentWithPassword(
|
||||
$filename,
|
||||
@@ -513,7 +513,7 @@ class PublicWebDavContext implements Context {
|
||||
$response = $this->publiclyUploadingContentWithPassword(
|
||||
$filename,
|
||||
$password,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -541,7 +541,7 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function thePublicUploadsFileWithContentUsingThePublicWebDavApi(
|
||||
string $filename,
|
||||
string $body = 'test'
|
||||
string $body = 'test',
|
||||
): void {
|
||||
$response = $this->publicUploadContent($filename, '', $body);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -572,11 +572,11 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function checkLastPublicSharedFileWithPasswordDownload(
|
||||
string $password,
|
||||
string $expectedContent
|
||||
string $expectedContent,
|
||||
): void {
|
||||
$response = $this->downloadPublicFileWithRange(
|
||||
"",
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
@@ -584,7 +584,7 @@ class PublicWebDavContext implements Context {
|
||||
$this->featureContext->checkDownloadedContentMatches(
|
||||
$expectedContent,
|
||||
"Checking the content of the last public shared file after downloading with the public WebDAV API",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -599,13 +599,13 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function shouldNotBeAbleToDownloadFileInsidePublicSharedFolder(
|
||||
string $path,
|
||||
string $expectedHttpCode = "401"
|
||||
string $expectedHttpCode = "401",
|
||||
): void {
|
||||
$response = $this->downloadFileFromPublicFolder(
|
||||
$path,
|
||||
"",
|
||||
"",
|
||||
$this->featureContext->isUsingSharingNG()
|
||||
$this->featureContext->isUsingSharingNG(),
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
||||
}
|
||||
@@ -620,13 +620,13 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPassword(
|
||||
string $path,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$response = $this->downloadFileFromPublicFolder(
|
||||
$path,
|
||||
$password,
|
||||
"",
|
||||
$this->featureContext->isUsingSharingNG()
|
||||
$this->featureContext->isUsingSharingNG(),
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
}
|
||||
@@ -644,7 +644,7 @@ class PublicWebDavContext implements Context {
|
||||
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordAndContentShouldBe(
|
||||
string $path,
|
||||
string $password,
|
||||
string $content
|
||||
string $content,
|
||||
): void {
|
||||
$response = $this->downloadFileFromPublicFolder(
|
||||
$path,
|
||||
@@ -669,13 +669,13 @@ class PublicWebDavContext implements Context {
|
||||
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordForSharingNGAndContentShouldBe(
|
||||
string $path,
|
||||
string $password,
|
||||
string $content
|
||||
string $content,
|
||||
): void {
|
||||
$response = $this->downloadFileFromPublicFolder(
|
||||
$path,
|
||||
$password,
|
||||
"",
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
@@ -695,13 +695,13 @@ class PublicWebDavContext implements Context {
|
||||
public function shouldNotBeAbleToDownloadFileInsidePublicSharedFolderWithPassword(
|
||||
string $path,
|
||||
string $password,
|
||||
string $expectedHttpCode = "401"
|
||||
string $expectedHttpCode = "401",
|
||||
): void {
|
||||
$response = $this->downloadFileFromPublicFolder(
|
||||
$path,
|
||||
$password,
|
||||
"",
|
||||
$this->featureContext->isUsingSharingNG()
|
||||
$this->featureContext->isUsingSharingNG(),
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
||||
}
|
||||
@@ -718,14 +718,14 @@ class PublicWebDavContext implements Context {
|
||||
public function shouldNotBeAbleToDownloadFileWithPasswordForShareNg(
|
||||
string $path,
|
||||
string $password,
|
||||
string $expectedHttpCode = "401"
|
||||
string $expectedHttpCode = "401",
|
||||
): void {
|
||||
$this->tryingToDownloadUsingWebDAVAPI(
|
||||
$path,
|
||||
"new",
|
||||
$password,
|
||||
$expectedHttpCode,
|
||||
true
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -743,13 +743,13 @@ class PublicWebDavContext implements Context {
|
||||
string $password,
|
||||
string $range = "",
|
||||
string $expectedHttpCode = "401",
|
||||
bool $shareNg = false
|
||||
bool $shareNg = false,
|
||||
): void {
|
||||
$response = $this->downloadFileFromPublicFolder(
|
||||
$path,
|
||||
$password,
|
||||
$range,
|
||||
$shareNg
|
||||
$shareNg,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
||||
}
|
||||
@@ -765,13 +765,13 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function publiclyUploadingShouldToSharedFileShouldFail(
|
||||
string $password,
|
||||
string $expectedHttpCode
|
||||
string $expectedHttpCode,
|
||||
): void {
|
||||
$filename = (string)$this->featureContext->getLastCreatedPublicShare()->file_target;
|
||||
|
||||
$response = $this->publicUploadContent(
|
||||
$filename,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
||||
@@ -787,16 +787,16 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function publiclyUploadingWithPasswordShouldNotWork(
|
||||
string $password,
|
||||
string $expectedHttpCode = null
|
||||
string $expectedHttpCode = null,
|
||||
): void {
|
||||
$response = $this->publicUploadContent(
|
||||
'whateverfilefortesting.txt',
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
Assert::assertGreaterThanOrEqual(
|
||||
$expectedHttpCode,
|
||||
$response->getStatusCode(),
|
||||
"upload should have failed but passed with code " . $response->getStatusCode()
|
||||
"upload should have failed but passed with code " . $response->getStatusCode(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -810,11 +810,11 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function publiclyUploadingIntoFolderWithPasswordShouldWork(
|
||||
string $filename,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$response = $this->publicUploadContent(
|
||||
$filename,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
||||
@@ -841,12 +841,12 @@ class PublicWebDavContext implements Context {
|
||||
Assert::assertTrue(
|
||||
($response->getStatusCode() === 201),
|
||||
"upload should have passed but failed with code " .
|
||||
$response->getStatusCode()
|
||||
$response->getStatusCode(),
|
||||
);
|
||||
$response = $this->downloadFileFromPublicFolder(
|
||||
$path,
|
||||
$password,
|
||||
""
|
||||
"",
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
$this->featureContext->checkDownloadedContentMatches($content, "", $response);
|
||||
@@ -872,31 +872,31 @@ class PublicWebDavContext implements Context {
|
||||
$response = $this->publicUploadContent(
|
||||
$path,
|
||||
$password,
|
||||
$content
|
||||
$content,
|
||||
);
|
||||
if ($should) {
|
||||
Assert::assertTrue(
|
||||
($response->getStatusCode() == 204),
|
||||
"upload should have passed but failed with code " .
|
||||
$response->getStatusCode()
|
||||
$response->getStatusCode(),
|
||||
);
|
||||
|
||||
$response = $this->downloadPublicFileWithRange(
|
||||
"",
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
|
||||
$this->featureContext->checkDownloadedContentMatches(
|
||||
$content,
|
||||
"Checking the content of the last public shared file after downloading with the public WebDAV API",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
} else {
|
||||
$expectedCode = 403;
|
||||
Assert::assertTrue(
|
||||
($response->getStatusCode() == $expectedCode),
|
||||
"upload should have failed with HTTP status $expectedCode but passed with code " .
|
||||
$response->getStatusCode()
|
||||
$response->getStatusCode(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -914,12 +914,12 @@ class PublicWebDavContext implements Context {
|
||||
string $destination,
|
||||
): void {
|
||||
$content = \file_get_contents(
|
||||
$this->featureContext->acceptanceTestsDirLocation() . $source
|
||||
$this->featureContext->acceptanceTestsDirLocation() . $source,
|
||||
);
|
||||
$response = $this->publicUploadContent(
|
||||
$destination,
|
||||
'',
|
||||
$content
|
||||
$content,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -937,15 +937,15 @@ class PublicWebDavContext implements Context {
|
||||
public function thePublicUploadsFileToInsideLastLinkSharedFolderWithPasswordUsingThePublicWebdavApi(
|
||||
string $source,
|
||||
string $destination,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$content = \file_get_contents(
|
||||
$this->featureContext->acceptanceTestsDirLocation() . $source
|
||||
$this->featureContext->acceptanceTestsDirLocation() . $source,
|
||||
);
|
||||
$response = $this->publicUploadContent(
|
||||
$destination,
|
||||
$password,
|
||||
$content
|
||||
$content,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -963,7 +963,7 @@ class PublicWebDavContext implements Context {
|
||||
public function thePublicUploadsFileToLastSharedFolderWithMtimeUsingTheWebdavApi(
|
||||
string $fileName,
|
||||
string $password,
|
||||
string $mtime
|
||||
string $mtime,
|
||||
): void {
|
||||
$mtime = new DateTime($mtime);
|
||||
$mtime = $mtime->format('U');
|
||||
@@ -973,7 +973,7 @@ class PublicWebDavContext implements Context {
|
||||
$password,
|
||||
'test',
|
||||
false,
|
||||
["X-OC-Mtime" => $mtime]
|
||||
["X-OC-Mtime" => $mtime],
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -986,7 +986,7 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function publicCreatesFolderUsingPassword(
|
||||
string $destination,
|
||||
string $password
|
||||
string $password,
|
||||
): ResponseInterface {
|
||||
$token = ($this->featureContext->isUsingSharingNG())
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
@@ -994,17 +994,17 @@ class PublicWebDavContext implements Context {
|
||||
$davPath = WebDavHelper::getDavPath(
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
$token,
|
||||
"public-files"
|
||||
"public-files",
|
||||
);
|
||||
$url = $this->featureContext->getBaseUrl() . "/$davPath/";
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$foldername = \implode(
|
||||
'/',
|
||||
\array_map('rawurlencode', \explode('/', $destination))
|
||||
\array_map('rawurlencode', \explode('/', $destination)),
|
||||
);
|
||||
$url .= \ltrim($foldername, '/');
|
||||
|
||||
@@ -1012,7 +1012,7 @@ class PublicWebDavContext implements Context {
|
||||
$url,
|
||||
'MKCOL',
|
||||
$userName,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1037,7 +1037,7 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function publicShouldBeAbleToCreateFolderWithPassword(
|
||||
string $foldername,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$response = $this->publicCreatesFolderUsingPassword($foldername, $password);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response);
|
||||
@@ -1055,14 +1055,14 @@ class PublicWebDavContext implements Context {
|
||||
public function publicCreationOfFolderWithPasswordShouldFail(
|
||||
string $foldername,
|
||||
string $password,
|
||||
string $expectedHttpCode
|
||||
string $expectedHttpCode,
|
||||
): void {
|
||||
$response = $this->publicCreatesFolderUsingPassword($foldername, $password);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
$expectedHttpCode,
|
||||
"creation of $foldername in the last publicly shared folder should have failed with code " .
|
||||
$expectedHttpCode,
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1077,7 +1077,7 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldBe(
|
||||
string $fileName,
|
||||
string $mtime
|
||||
string $mtime,
|
||||
): void {
|
||||
$token = ($this->featureContext->isUsingSharingNG())
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
@@ -1092,7 +1092,7 @@ class PublicWebDavContext implements Context {
|
||||
$baseUrl,
|
||||
$fileName,
|
||||
$token,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1107,7 +1107,7 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldNotBe(
|
||||
string $fileName,
|
||||
string $mtime
|
||||
string $mtime,
|
||||
): void {
|
||||
$token = $this->featureContext->getLastCreatedPublicShareToken();
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
@@ -1117,7 +1117,7 @@ class PublicWebDavContext implements Context {
|
||||
$baseUrl,
|
||||
$fileName,
|
||||
$token,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1148,16 +1148,16 @@ class PublicWebDavContext implements Context {
|
||||
$davPath = WebDavHelper::getDavPath(
|
||||
WebDavHelper::DAV_VERSION_NEW,
|
||||
$token,
|
||||
"public-files"
|
||||
"public-files",
|
||||
);
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
|
||||
$filename = \implode(
|
||||
'/',
|
||||
\array_map('rawurlencode', \explode('/', $filename))
|
||||
\array_map('rawurlencode', \explode('/', $filename)),
|
||||
);
|
||||
$encodedFilePath = \ltrim($filename, '/');
|
||||
$url = $this->featureContext->getBaseUrl() . "/$davPath/$encodedFilePath";
|
||||
@@ -1176,7 +1176,7 @@ class PublicWebDavContext implements Context {
|
||||
$userName,
|
||||
$password,
|
||||
$headers,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1188,7 +1188,7 @@ class PublicWebDavContext implements Context {
|
||||
*/
|
||||
private function getUsernameForPublicWebdavApi(
|
||||
string $token,
|
||||
string $password
|
||||
string $password,
|
||||
): ?string {
|
||||
if ($password !== '') {
|
||||
$userName = 'public';
|
||||
@@ -1243,12 +1243,12 @@ class PublicWebDavContext implements Context {
|
||||
$davPath = WebDavHelper::getDavPath(
|
||||
WebDavHelper::DAV_VERSION_NEW,
|
||||
$token,
|
||||
"public-files"
|
||||
"public-files",
|
||||
);
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
$username = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath";
|
||||
$response = HttpRequestHelper::sendRequest(
|
||||
@@ -1257,7 +1257,7 @@ class PublicWebDavContext implements Context {
|
||||
$username,
|
||||
$password,
|
||||
null,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class SearchContext implements Context {
|
||||
?string $scopeType = null,
|
||||
?string $scope = null,
|
||||
?string $spaceName = null,
|
||||
?TableNode $properties = null
|
||||
?TableNode $properties = null,
|
||||
): ResponseInterface {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
@@ -87,7 +87,7 @@ class SearchContext implements Context {
|
||||
$resourceID = $this->featureContext->spacesContext->getResourceId(
|
||||
$user,
|
||||
$spaceName ?? "Personal",
|
||||
$scope
|
||||
$scope,
|
||||
);
|
||||
$pattern .= " scope:$resourceID";
|
||||
}
|
||||
@@ -122,7 +122,7 @@ class SearchContext implements Context {
|
||||
$user,
|
||||
$password,
|
||||
null,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class SearchContext implements Context {
|
||||
string $user,
|
||||
string $pattern,
|
||||
?string $limit = null,
|
||||
?TableNode $properties = null
|
||||
?TableNode $properties = null,
|
||||
): void {
|
||||
// NOTE: because indexing of newly uploaded files or directories with ocis is decoupled and occurs asynchronously
|
||||
// short wait is necessary before searching
|
||||
@@ -166,28 +166,28 @@ class SearchContext implements Context {
|
||||
public function fileOrFolderInTheSearchResultShouldContainProperties(
|
||||
string $path,
|
||||
string $user,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$this->featureContext->verifyTableNodeColumns($properties, ['name', 'value']);
|
||||
$properties = $properties->getHash();
|
||||
$fileResult = $this->featureContext->findEntryFromSearchResponse(
|
||||
$path
|
||||
$path,
|
||||
);
|
||||
Assert::assertNotFalse(
|
||||
$fileResult,
|
||||
"could not find file/folder '$path'"
|
||||
"could not find file/folder '$path'",
|
||||
);
|
||||
foreach ($properties as $property) {
|
||||
$property['value'] = $this->featureContext->substituteInLineCodes(
|
||||
$property['value'],
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
$fileResultProperty = $fileResult->xpath("d:propstat//" . $property['name']);
|
||||
if ($fileResultProperty) {
|
||||
Assert::assertMatchesRegularExpression(
|
||||
"/" . $property['value'] . "/",
|
||||
\trim((string)$fileResultProperty[0])
|
||||
\trim((string)$fileResultProperty[0]),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -224,13 +224,13 @@ class SearchContext implements Context {
|
||||
*/
|
||||
public function theSearchResultShouldContainEntriesWithHighlight(
|
||||
TableNode $expectedFiles,
|
||||
string $expectedContent
|
||||
string $expectedContent,
|
||||
): void {
|
||||
$this->featureContext->verifyTableNodeColumnsCount($expectedFiles, 1);
|
||||
$elementRows = $expectedFiles->getRows();
|
||||
$foundEntries = $this->featureContext->findEntryFromSearchResponse(
|
||||
null,
|
||||
true
|
||||
true,
|
||||
);
|
||||
foreach ($elementRows as $expectedFile) {
|
||||
$filename = $expectedFile[0];
|
||||
@@ -244,7 +244,7 @@ class SearchContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$expectedContent,
|
||||
$actualContent,
|
||||
"Expected text highlight to be '$expectedContent' but found '$actualContent'"
|
||||
"Expected text highlight to be '$expectedContent' but found '$actualContent'",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class SettingsContext implements Context {
|
||||
return SettingsHelper::getRolesList(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user)
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class SettingsContext implements Context {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
201,
|
||||
"Expected response status code should be 201",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -150,12 +150,12 @@ class SettingsContext implements Context {
|
||||
public function userAssignsTheRoleToUserUsingTheSettingsApi(
|
||||
string $assigner,
|
||||
string $role,
|
||||
string $assignee
|
||||
string $assignee,
|
||||
): void {
|
||||
$response = $this->assignRoleToUser(
|
||||
$assigner,
|
||||
$this->featureContext->getAttributeOfCreatedUser($assignee, 'id'),
|
||||
$this->getRoleIdByRoleName($assigner, $role)
|
||||
$this->getRoleIdByRoleName($assigner, $role),
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ class SettingsContext implements Context {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
201,
|
||||
"Expected response status code should be 201",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
|
||||
$rawBody = $response->getBody()->getContents();
|
||||
@@ -201,7 +201,7 @@ class SettingsContext implements Context {
|
||||
Assert::assertArrayHasKey(
|
||||
'bundles',
|
||||
$decodedBody,
|
||||
__METHOD__ . " could not find bundles in body"
|
||||
__METHOD__ . " could not find bundles in body",
|
||||
);
|
||||
$bundles = $decodedBody["bundles"];
|
||||
|
||||
@@ -287,7 +287,7 @@ class SettingsContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role),
|
||||
$actualRoleId,
|
||||
"user $user has no role $role"
|
||||
"user $user has no role $role",
|
||||
);
|
||||
} else {
|
||||
Assert::fail("Response should contain user role but not found.\n" . json_encode($assignmentResponse));
|
||||
@@ -305,12 +305,12 @@ class SettingsContext implements Context {
|
||||
*/
|
||||
public function theSettingApiResponseShouldHaveTheRole(string $role): void {
|
||||
$assignmentRoleId = $this->featureContext->getJsonDecodedResponse(
|
||||
$this->featureContext->getResponse()
|
||||
$this->featureContext->getResponse(),
|
||||
)["assignments"][0]["roleId"];
|
||||
Assert::assertEquals(
|
||||
$this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role),
|
||||
$assignmentRoleId,
|
||||
"user has no role $role"
|
||||
"user has no role $role",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ class SettingsContext implements Context {
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ class SettingsContext implements Context {
|
||||
public function theUserListsAllValuesListWithHeadersUsingSettingsApi(string $user, TableNode $headersTable): void {
|
||||
$this->featureContext->verifyTableNodeColumns(
|
||||
$headersTable,
|
||||
['header', 'value']
|
||||
['header', 'value'],
|
||||
);
|
||||
$headers = [];
|
||||
foreach ($headersTable as $row) {
|
||||
@@ -431,7 +431,7 @@ class SettingsContext implements Context {
|
||||
"settingId" => $settingId,
|
||||
],
|
||||
],
|
||||
JSON_THROW_ON_ERROR
|
||||
JSON_THROW_ON_ERROR,
|
||||
);
|
||||
return SettingsHelper::updateSettings(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
@@ -457,7 +457,7 @@ class SettingsContext implements Context {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
201,
|
||||
"Expected response status code should be 201",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ class SettingsContext implements Context {
|
||||
"boolValue" => $status,
|
||||
],
|
||||
],
|
||||
JSON_THROW_ON_ERROR
|
||||
JSON_THROW_ON_ERROR,
|
||||
);
|
||||
|
||||
return SettingsHelper::updateSettings(
|
||||
@@ -526,7 +526,7 @@ class SettingsContext implements Context {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
201,
|
||||
"Expected response status code should be 201",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
$this->featureContext->rememberUserAutoSyncSetting($user, false);
|
||||
}
|
||||
@@ -590,7 +590,7 @@ class SettingsContext implements Context {
|
||||
public function enableOrDisableNotification(
|
||||
string $user,
|
||||
string $enableOrDisable,
|
||||
array $event
|
||||
array $event,
|
||||
): ResponseInterface {
|
||||
$body = [
|
||||
"value" => [
|
||||
@@ -638,7 +638,7 @@ class SettingsContext implements Context {
|
||||
public function userHasEnabledOrDisabledNotificationForTheFollowingEventUsingTheSettingsApi(
|
||||
string $user,
|
||||
string $enableOrDisable,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$event = $table->getRowsHash();
|
||||
$response = $this->enableOrDisableNotification($user, $enableOrDisable, $event);
|
||||
@@ -657,7 +657,7 @@ class SettingsContext implements Context {
|
||||
public function userEnablesOrDisablesNotificationForTheFollowingEventUsingTheSettingsApi(
|
||||
string $user,
|
||||
string $enableOrDisable,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$event = $table->getRowsHash();
|
||||
$response = $this->enableOrDisableNotification($user, $enableOrDisable, $event);
|
||||
@@ -757,14 +757,14 @@ class SettingsContext implements Context {
|
||||
Assert::fail(
|
||||
"Setting '$settingName' does not have a stringValue, boolValue or listValue."
|
||||
. "\n"
|
||||
. json_encode($setting)
|
||||
. json_encode($setting),
|
||||
);
|
||||
}
|
||||
|
||||
Assert::assertSame(
|
||||
$value,
|
||||
$settingValue,
|
||||
"Expected setting value '$value' but got '$settingValue'"
|
||||
"Expected setting value '$value' but got '$settingValue'",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ class ShareesContext implements Context {
|
||||
$this->featureContext->setResponse(
|
||||
$this->getShareesWithParameters(
|
||||
$this->featureContext->getCurrentUser(),
|
||||
$body
|
||||
)
|
||||
$body,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ class ShareesContext implements Context {
|
||||
$this->featureContext->setResponse(
|
||||
$this->getShareesWithParameters(
|
||||
$user,
|
||||
$body
|
||||
)
|
||||
$body,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -86,12 +86,12 @@ class ShareesContext implements Context {
|
||||
$sharees = $shareesList->getRows();
|
||||
$respondedArray = $this->getArrayOfShareesResponded(
|
||||
$this->featureContext->getResponse(),
|
||||
$shareeType
|
||||
$shareeType,
|
||||
);
|
||||
Assert::assertEquals(
|
||||
$sharees,
|
||||
$respondedArray,
|
||||
"Returned sharees do not match the expected ones. See the differences below."
|
||||
"Returned sharees do not match the expected ones. See the differences below.",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -109,13 +109,13 @@ class ShareesContext implements Context {
|
||||
$sharees = $shareesList->getRows();
|
||||
$respondedArray = $this->getArrayOfShareesResponded(
|
||||
$this->featureContext->getResponse(),
|
||||
$shareeType
|
||||
$shareeType,
|
||||
);
|
||||
foreach ($sharees as $sharee) {
|
||||
Assert::assertContains(
|
||||
$sharee,
|
||||
$respondedArray,
|
||||
"Returned sharees do not match the expected ones. See the differences below."
|
||||
"Returned sharees do not match the expected ones. See the differences below.",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class ShareesContext implements Context {
|
||||
public function theShareesReturnedShouldBeEmpty(string $shareeType): void {
|
||||
$respondedArray = $this->getArrayOfShareesResponded(
|
||||
$this->featureContext->getResponse(),
|
||||
$shareeType
|
||||
$shareeType,
|
||||
);
|
||||
if (isset($respondedArray[0])) {
|
||||
// [0] is display name and [2] is user or group id
|
||||
@@ -141,7 +141,7 @@ class ShareesContext implements Context {
|
||||
|
||||
Assert::assertEmpty(
|
||||
$respondedArray,
|
||||
"'$shareeType' array should be empty, but it starts with $firstEntry"
|
||||
"'$shareeType' array should be empty, but it starts with $firstEntry",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ class ShareesContext implements Context {
|
||||
*/
|
||||
public function getArrayOfShareesResponded(
|
||||
ResponseInterface $response,
|
||||
string $shareeType
|
||||
string $shareeType,
|
||||
): array {
|
||||
$elements = HttpRequestHelper::getResponseXml($response, __METHOD__)->data;
|
||||
$elements = \json_decode(\json_encode($elements), true);
|
||||
@@ -166,7 +166,7 @@ class ShareesContext implements Context {
|
||||
Assert::assertArrayHasKey(
|
||||
$shareeType,
|
||||
$elements,
|
||||
__METHOD__ . " The sharees response does not have key '$shareeType'"
|
||||
__METHOD__ . " The sharees response does not have key '$shareeType'",
|
||||
);
|
||||
|
||||
$sharees = [];
|
||||
@@ -215,7 +215,7 @@ class ShareesContext implements Context {
|
||||
return $this->ocsContext->sendRequestToOcsEndpoint(
|
||||
$user,
|
||||
'GET',
|
||||
$url
|
||||
$url,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -102,7 +102,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
$itemId,
|
||||
\json_encode($body)
|
||||
\json_encode($body),
|
||||
);
|
||||
|
||||
if ($response->getStatusCode() == 200) {
|
||||
@@ -146,7 +146,7 @@ class SharingNgContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
\json_encode($body)
|
||||
\json_encode($body),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ class SharingNgContext implements Context {
|
||||
string $user,
|
||||
string $space,
|
||||
?string $resource = '',
|
||||
?string $query = null
|
||||
?string $query = null,
|
||||
): ResponseInterface {
|
||||
if ($space === "Shares") {
|
||||
$spaceId = $this->spacesContext->getSharesRemoteItemParentDriveId($user, $resource);
|
||||
@@ -179,7 +179,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
$itemId,
|
||||
$query
|
||||
$query,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -196,10 +196,10 @@ class SharingNgContext implements Context {
|
||||
public function userGetsPermissionsListForResourceOfTheSpaceUsingTheGraphAPI(
|
||||
string $user,
|
||||
string $resource,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->getPermissionsList($user, $space, $resource)
|
||||
$this->getPermissionsList($user, $space, $resource),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class SharingNgContext implements Context {
|
||||
string $user,
|
||||
string $resource,
|
||||
string $space,
|
||||
string $shareMethods
|
||||
string $shareMethods,
|
||||
): void {
|
||||
if ($shareMethods === 'link') {
|
||||
$permissionId = $this->featureContext->shareNgGetLastCreatedLinkShareID();
|
||||
@@ -234,7 +234,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
$itemId,
|
||||
$permissionId
|
||||
$permissionId,
|
||||
);
|
||||
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -259,8 +259,8 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
$itemId,
|
||||
null
|
||||
)
|
||||
null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ class SharingNgContext implements Context {
|
||||
public function userTriesToListThePermissionsOfSpaceUsingPermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
string $space,
|
||||
string $spaceOwner
|
||||
string $spaceOwner,
|
||||
): void {
|
||||
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
|
||||
$itemId = $this->spacesContext->getResourceId($spaceOwner, $space, '');
|
||||
@@ -288,8 +288,8 @@ class SharingNgContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
$itemId
|
||||
)
|
||||
$itemId,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ class SharingNgContext implements Context {
|
||||
string $user,
|
||||
array $shareInfo,
|
||||
string $fileId = null,
|
||||
bool $federatedShare = false
|
||||
bool $federatedShare = false,
|
||||
): ResponseInterface {
|
||||
$space = $this->spacesContext->getSpaceByName($user, $shareInfo['space']);
|
||||
$spaceId = $space['id'];
|
||||
@@ -348,7 +348,7 @@ class SharingNgContext implements Context {
|
||||
$shareeId = (
|
||||
$this->featureContext->ocmContext->getAcceptedUserByName(
|
||||
$user,
|
||||
$sharee
|
||||
$sharee,
|
||||
)
|
||||
)['user_id'];
|
||||
}
|
||||
@@ -374,7 +374,7 @@ class SharingNgContext implements Context {
|
||||
$shareTypes,
|
||||
$permissionsRole,
|
||||
$permissionsAction,
|
||||
$expirationDateTime
|
||||
$expirationDateTime,
|
||||
);
|
||||
if ($response->getStatusCode() === 200) {
|
||||
$this->featureContext->shareNgAddToCreatedUserGroupShares($response);
|
||||
@@ -398,7 +398,7 @@ class SharingNgContext implements Context {
|
||||
public function sendDriveShareInvitation(
|
||||
string $user,
|
||||
TableNode $table,
|
||||
bool $federatedShare = false
|
||||
bool $federatedShare = false,
|
||||
): ResponseInterface {
|
||||
$shareeIds = [];
|
||||
$rows = $table->getRowsHash();
|
||||
@@ -441,7 +441,7 @@ class SharingNgContext implements Context {
|
||||
$shareTypes,
|
||||
$permissionsRole,
|
||||
$permissionsAction,
|
||||
$expirationDateTime
|
||||
$expirationDateTime,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ class SharingNgContext implements Context {
|
||||
Assert::assertArrayHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should be provided in the data-table while sharing a resource"
|
||||
"'resource' should be provided in the data-table while sharing a resource",
|
||||
);
|
||||
$response = $this->sendShareInvitation($user, $rows);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
@@ -478,13 +478,13 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userHasSentTheFollowingResourceShareInvitationToFederatedUser(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$rows = $table->getRowsHash();
|
||||
Assert::assertArrayHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should be provided in the data-table while sharing a resource"
|
||||
"'resource' should be provided in the data-table while sharing a resource",
|
||||
);
|
||||
$response = $this->sendShareInvitation($user, $rows, null, true);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
@@ -505,7 +505,7 @@ class SharingNgContext implements Context {
|
||||
Assert::assertArrayNotHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should not be provided in the data-table while sharing a space"
|
||||
"'resource' should not be provided in the data-table while sharing a space",
|
||||
);
|
||||
$response = $this->sendDriveShareInvitation($user, $table);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
@@ -527,10 +527,10 @@ class SharingNgContext implements Context {
|
||||
Assert::assertArrayHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should be provided in the data-table while sharing a resource"
|
||||
"'resource' should be provided in the data-table while sharing a resource",
|
||||
);
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendShareInvitation($user, $rows)
|
||||
$this->sendShareInvitation($user, $rows),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -546,16 +546,16 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userSendsTheFollowingResourceShareInvitationToFederatedUserUsingTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$rows = $table->getRowsHash();
|
||||
Assert::assertArrayHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should be provided in the data-table while sharing a resource"
|
||||
"'resource' should be provided in the data-table while sharing a resource",
|
||||
);
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendShareInvitation($user, $rows, null, true)
|
||||
$this->sendShareInvitation($user, $rows, null, true),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userSendsTheFollowingResourcesShareInvitationConcurrentlyToFederatedUserUsingTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$results = $this->sendConcurrentShareInvitation($user, $table);
|
||||
foreach ($results as $result) {
|
||||
@@ -597,7 +597,7 @@ class SharingNgContext implements Context {
|
||||
$shareeId = (
|
||||
$this->featureContext->ocmContext->getAcceptedUserByName(
|
||||
$user,
|
||||
$shareInfo["sharee"]
|
||||
$shareInfo["sharee"],
|
||||
)
|
||||
)['user_id'];
|
||||
|
||||
@@ -614,21 +614,21 @@ class SharingNgContext implements Context {
|
||||
|
||||
$fullUrl = GraphHelper::getBetaFullUrl(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
"drives/$spaceId/items/$itemId/invite"
|
||||
"drives/$spaceId/items/$itemId/invite",
|
||||
);
|
||||
|
||||
$request = HttpRequestHelper::createRequest(
|
||||
$fullUrl,
|
||||
"POST",
|
||||
['Content-Type' => 'application/json'],
|
||||
\json_encode($body)
|
||||
\json_encode($body),
|
||||
);
|
||||
$requests[] = $request;
|
||||
}
|
||||
|
||||
$client = HttpRequestHelper::createClient(
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user)
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
);
|
||||
|
||||
return HttpRequestHelper::sendBatchRequest($requests, $client);
|
||||
@@ -646,16 +646,16 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userSendsTheFollowingSpaceShareInvitationUsingPermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$rows = $table->getRowsHash();
|
||||
Assert::assertArrayNotHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should not be provided in the data-table while sharing a space"
|
||||
"'resource' should not be provided in the data-table while sharing a space",
|
||||
);
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendShareInvitation($user, $rows)
|
||||
$this->sendShareInvitation($user, $rows),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -671,16 +671,16 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userSendsTheFollowingSpaceShareInvitationToFederatedUserUsingPermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$rows = $table->getRowsHash();
|
||||
Assert::assertArrayNotHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should not be provided in the data-table while sharing a space"
|
||||
"'resource' should not be provided in the data-table while sharing a space",
|
||||
);
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendShareInvitation($user, $rows, null, true)
|
||||
$this->sendShareInvitation($user, $rows, null, true),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -697,7 +697,7 @@ class SharingNgContext implements Context {
|
||||
$response = $this->updateResourceShare(
|
||||
$user,
|
||||
$table,
|
||||
$permissionID
|
||||
$permissionID,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Expected response status code should be 200", $response);
|
||||
}
|
||||
@@ -716,8 +716,8 @@ class SharingNgContext implements Context {
|
||||
$this->updateResourceShare(
|
||||
$user,
|
||||
$table,
|
||||
$permissionID
|
||||
)
|
||||
$permissionID,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ class SharingNgContext implements Context {
|
||||
string $user,
|
||||
string $shareType,
|
||||
string $sharee,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$permissionID = "";
|
||||
if ($shareType === "user") {
|
||||
@@ -748,8 +748,8 @@ class SharingNgContext implements Context {
|
||||
$this->updateResourceShare(
|
||||
$user,
|
||||
$table,
|
||||
$permissionID
|
||||
)
|
||||
$permissionID,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ class SharingNgContext implements Context {
|
||||
$spaceId,
|
||||
$itemId,
|
||||
\json_encode($body),
|
||||
$permissionID
|
||||
$permissionID,
|
||||
);
|
||||
|
||||
if ($response->getStatusCode() === 200) {
|
||||
@@ -812,11 +812,11 @@ class SharingNgContext implements Context {
|
||||
public function userSendsTheFollowingShareInvitationWithFileIdUsingTheGraphApi(
|
||||
string $user,
|
||||
string $fileId,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$rows = $table->getRowsHash();
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendShareInvitation($user, $rows, $fileId)
|
||||
$this->sendShareInvitation($user, $rows, $fileId),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -845,7 +845,7 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userCreatesTheFollowingSpaceLinkShareUsingPermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $body
|
||||
TableNode $body,
|
||||
): void {
|
||||
$this->featureContext->setResponse($this->createLinkShare($user, $body));
|
||||
}
|
||||
@@ -861,7 +861,7 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userHasCreatedTheFollowingSpaceLinkShareUsingPermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $body
|
||||
TableNode $body,
|
||||
): void {
|
||||
$response = $this->createLinkShare($user, $body);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
|
||||
@@ -881,7 +881,7 @@ class SharingNgContext implements Context {
|
||||
Assert::assertArrayHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should be provided in the data-table while sharing a resource"
|
||||
"'resource' should be provided in the data-table while sharing a resource",
|
||||
);
|
||||
$response = $this->createLinkShare($user, $body);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
|
||||
@@ -901,7 +901,7 @@ class SharingNgContext implements Context {
|
||||
Assert::assertArrayNotHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should not be provided in the data-table while sharing a space"
|
||||
"'resource' should not be provided in the data-table while sharing a space",
|
||||
);
|
||||
$response = $this->createDriveLinkShare($user, $body);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
|
||||
@@ -921,7 +921,7 @@ class SharingNgContext implements Context {
|
||||
$response = $this->updateLinkShare(
|
||||
$user,
|
||||
$body,
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while updating public share link!", $response);
|
||||
}
|
||||
@@ -937,14 +937,14 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userUpdatesTheLastPublicLinkShareUsingThePermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $body
|
||||
TableNode $body,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->updateLinkShare(
|
||||
$user,
|
||||
$body,
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
||||
)
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -987,7 +987,7 @@ class SharingNgContext implements Context {
|
||||
$spaceId,
|
||||
$itemId,
|
||||
\json_encode($body),
|
||||
$permissionID
|
||||
$permissionID,
|
||||
);
|
||||
|
||||
if ($response->getStatusCode() === 200) {
|
||||
@@ -1027,7 +1027,7 @@ class SharingNgContext implements Context {
|
||||
$spaceId,
|
||||
$itemId,
|
||||
\json_encode($body),
|
||||
$permissionID
|
||||
$permissionID,
|
||||
);
|
||||
|
||||
if ($response->getStatusCode() === 200) {
|
||||
@@ -1049,12 +1049,12 @@ class SharingNgContext implements Context {
|
||||
$response = $this->setLinkSharePassword(
|
||||
$user,
|
||||
$body,
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
200,
|
||||
"Failed while setting public share link password!",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1069,14 +1069,14 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userSetsOrUpdatesFollowingPasswordForLastLinkShareUsingTheGraphApi(
|
||||
string $user,
|
||||
TableNode $body
|
||||
TableNode $body,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->setLinkSharePassword(
|
||||
$user,
|
||||
$body,
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
||||
)
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1098,7 +1098,7 @@ class SharingNgContext implements Context {
|
||||
string $shareType,
|
||||
string $space,
|
||||
?string $resource = null,
|
||||
?string $recipient = null
|
||||
?string $recipient = null,
|
||||
): ResponseInterface {
|
||||
$spaceId = ($this->spacesContext->getSpaceByName($sharer, $space))["id"];
|
||||
$itemId = (isset($resource)) ? $this->spacesContext->getResourceId($sharer, $space, $resource)
|
||||
@@ -1128,7 +1128,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getPasswordForUser($sharer),
|
||||
$spaceId,
|
||||
$itemId,
|
||||
$permissionID
|
||||
$permissionID,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1148,7 +1148,7 @@ class SharingNgContext implements Context {
|
||||
string $sharer,
|
||||
string $shareType,
|
||||
string $space,
|
||||
?string $recipient = null
|
||||
?string $recipient = null,
|
||||
): ResponseInterface {
|
||||
$spaceId = ($this->spacesContext->getSpaceByName($sharer, $space))["id"];
|
||||
|
||||
@@ -1165,7 +1165,7 @@ class SharingNgContext implements Context {
|
||||
$sharer,
|
||||
$this->featureContext->getPasswordForUser($sharer),
|
||||
$spaceId,
|
||||
$permissionID
|
||||
$permissionID,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1187,7 +1187,7 @@ class SharingNgContext implements Context {
|
||||
string $recipientType,
|
||||
string $recipient,
|
||||
string $resource,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$response = $this->removeAccessToSpaceItem($sharer, $recipientType, $space, $resource);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||
@@ -1211,10 +1211,10 @@ class SharingNgContext implements Context {
|
||||
string $recipientType,
|
||||
string $recipient,
|
||||
string $resource,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->removeAccessToSpaceItem($sharer, $recipientType, $space, $resource, $recipient)
|
||||
$this->removeAccessToSpaceItem($sharer, $recipientType, $space, $resource, $recipient),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1234,10 +1234,10 @@ class SharingNgContext implements Context {
|
||||
string $sharer,
|
||||
string $recipientType,
|
||||
string $recipient,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->removeAccessToSpaceItem($sharer, $recipientType, $space, null, $recipient)
|
||||
$this->removeAccessToSpaceItem($sharer, $recipientType, $space, null, $recipient),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1255,7 +1255,7 @@ class SharingNgContext implements Context {
|
||||
public function userHasRemovedTheLastLinkShareOfFileOrFolderFromSpace(
|
||||
string $sharer,
|
||||
string $resource,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$response = $this->removeAccessToSpaceItem($sharer, 'link', $space, $resource);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||
@@ -1275,10 +1275,10 @@ class SharingNgContext implements Context {
|
||||
public function userRemovesSharePermissionOfAResourceInLinkShareUsingGraphAPI(
|
||||
string $sharer,
|
||||
string $resource,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->removeAccessToSpaceItem($sharer, 'link', $space, $resource)
|
||||
$this->removeAccessToSpaceItem($sharer, 'link', $space, $resource),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1299,10 +1299,10 @@ class SharingNgContext implements Context {
|
||||
string $sharer,
|
||||
string $recipientType,
|
||||
string $recipient,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->removeAccessToSpace($sharer, $recipientType, $space, $recipient)
|
||||
$this->removeAccessToSpace($sharer, $recipientType, $space, $recipient),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1318,10 +1318,10 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userRemovesLinkFromSpaceUsingRootEndpointOfGraphAPI(
|
||||
string $sharer,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->removeAccessToSpace($sharer, 'link', $space)
|
||||
$this->removeAccessToSpace($sharer, 'link', $space),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1341,7 +1341,7 @@ class SharingNgContext implements Context {
|
||||
string $sharer,
|
||||
string $recipientType,
|
||||
string $recipient,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$response = $this->removeAccessToSpace($sharer, $recipientType, $space, $recipient);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||
@@ -1361,7 +1361,7 @@ class SharingNgContext implements Context {
|
||||
string $sharee,
|
||||
string $shareID,
|
||||
bool $hide = true,
|
||||
bool $federatedShare = false
|
||||
bool $federatedShare = false,
|
||||
): ResponseInterface {
|
||||
$shareSpaceId = GraphHelper::SHARES_SPACE_ID;
|
||||
if ($federatedShare) {
|
||||
@@ -1376,7 +1376,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getPasswordForUser($sharee),
|
||||
$itemId,
|
||||
$shareSpaceId,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1402,7 +1402,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
204,
|
||||
__METHOD__ . " could not disable sync of last share",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1508,7 +1508,7 @@ class SharingNgContext implements Context {
|
||||
string $user,
|
||||
string $share,
|
||||
string $offeredBy,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$share = ltrim($share, '/');
|
||||
$itemId = $this->spacesContext->getResourceId($offeredBy, $space, $share);
|
||||
@@ -1518,7 +1518,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$itemId,
|
||||
$shareSpaceId
|
||||
$shareSpaceId,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -1542,7 +1542,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$remoteItemId,
|
||||
GraphHelper::SHARES_SPACE_ID
|
||||
GraphHelper::SHARES_SPACE_ID,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -1568,7 +1568,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$itemId,
|
||||
$shareSpaceId
|
||||
$shareSpaceId,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -1591,7 +1591,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$itemId,
|
||||
$shareSpaceId
|
||||
$shareSpaceId,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -1608,7 +1608,7 @@ class SharingNgContext implements Context {
|
||||
$response = GraphHelper::getSharesSharedWithMe(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user)
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
);
|
||||
|
||||
$shares = $this->featureContext->getJsonDecodedResponse($response)["value"];
|
||||
@@ -1694,18 +1694,18 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userShouldBeAbleToSendShareTheFollowingInvitationWithAllAllowedPermissionRoles(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$listPermissionResponse = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||
if (!isset($listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'})) {
|
||||
Assert::fail(
|
||||
"The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n"
|
||||
. $listPermissionResponse
|
||||
. $listPermissionResponse,
|
||||
);
|
||||
}
|
||||
Assert::assertNotEmpty(
|
||||
$listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'},
|
||||
"'@libre.graph.permissions.roles.allowedValues' should not be empty"
|
||||
"'@libre.graph.permissions.roles.allowedValues' should not be empty",
|
||||
);
|
||||
$allowedPermissionRoles = $listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'};
|
||||
// this info is needed for log to see which roles allowed and which were not when tests fail
|
||||
@@ -1723,10 +1723,10 @@ class SharingNgContext implements Context {
|
||||
$roleAllowed = GraphHelper::getPermissionNameByPermissionRoleId($role->id);
|
||||
$responseSendInvitation = $this->sendShareInvitation(
|
||||
$user,
|
||||
array_merge($rows, ['permissionsRole' => $roleAllowed])
|
||||
array_merge($rows, ['permissionsRole' => $roleAllowed]),
|
||||
);
|
||||
$jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent(
|
||||
$responseSendInvitation
|
||||
$responseSendInvitation,
|
||||
);
|
||||
$httpsStatusCode = $responseSendInvitation->getStatusCode();
|
||||
if ($httpsStatusCode === 200 && !empty($jsonResponseSendInvitation->value)) {
|
||||
@@ -1760,7 +1760,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId
|
||||
$spaceId,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -1785,7 +1785,7 @@ class SharingNgContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
$permissionID
|
||||
$permissionID,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -1803,7 +1803,7 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userListsPermissionOfSpaceSharedViaLinkUsingRootEndpointGraphApi(
|
||||
string $user,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"];
|
||||
$permissionId = $this->featureContext->shareNgGetLastCreatedLinkShareID();
|
||||
@@ -1812,7 +1812,7 @@ class SharingNgContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
$permissionId
|
||||
$permissionId,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -1828,7 +1828,7 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userSendsTheFollowingShareInvitationUsingRootEndPointTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$response = $this->sendDriveShareInvitation($user, $table);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -1845,7 +1845,7 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userSendsTheFollowingShareInvitationToFederatedUserUsingRootEndPointTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$response = $this->sendDriveShareInvitation($user, $table, true);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -1862,7 +1862,7 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userUpdatesTheLastDriveShareWithTheFollowingUsingRootEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$bodyRows = $table->getRowsHash();
|
||||
$permissionID = match ($bodyRows['shareType']) {
|
||||
@@ -1890,8 +1890,8 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
\json_encode($body),
|
||||
$permissionID
|
||||
)
|
||||
$permissionID,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1906,13 +1906,13 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userCreatesTheFollowingSpaceLinkShareUsingRootEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $body
|
||||
TableNode $body,
|
||||
): void {
|
||||
$rows = $body->getRowsHash();
|
||||
Assert::assertArrayNotHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should not be provided in the data-table while sharing a space"
|
||||
"'resource' should not be provided in the data-table while sharing a space",
|
||||
);
|
||||
$response = $this->createDriveLinkShare($user, $body);
|
||||
|
||||
@@ -1930,13 +1930,13 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userSetsTheFollowingPasswordForTheLastSpaceLinkShareUsingRootEndpointOfTheGraphAPI(
|
||||
string $user,
|
||||
TableNode $body
|
||||
TableNode $body,
|
||||
): void {
|
||||
$rows = $body->getRowsHash();
|
||||
Assert::assertArrayNotHasKey(
|
||||
"resource",
|
||||
$rows,
|
||||
"'resource' should not be provided in the data-table while setting password in space shared link"
|
||||
"'resource' should not be provided in the data-table while setting password in space shared link",
|
||||
);
|
||||
|
||||
Assert::assertArrayHasKey("password", $rows, "'password' is missing in the data-table");
|
||||
@@ -1953,7 +1953,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
\json_encode($body),
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
||||
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -1971,7 +1971,7 @@ class SharingNgContext implements Context {
|
||||
public function userTriesToRemoveShareLinkOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
string $space,
|
||||
string $spaceOwner
|
||||
string $spaceOwner,
|
||||
): void {
|
||||
$permissionID = $this->featureContext->shareNgGetLastCreatedLinkShareID();
|
||||
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
|
||||
@@ -1981,7 +1981,7 @@ class SharingNgContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId,
|
||||
$permissionID
|
||||
$permissionID,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -2003,7 +2003,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId
|
||||
$spaceId,
|
||||
);
|
||||
$responseBody = $this->featureContext->getJsonDecodedResponse($response);
|
||||
foreach ($responseBody['value'] as $value) {
|
||||
@@ -2012,14 +2012,14 @@ class SharingNgContext implements Context {
|
||||
Assert::assertArrayNotHasKey(
|
||||
'link',
|
||||
$value,
|
||||
$space . ' space should not have any link permissions but found ' . print_r($value, true)
|
||||
$space . ' space should not have any link permissions but found ' . print_r($value, true),
|
||||
);
|
||||
break;
|
||||
case $shareType === "share":
|
||||
Assert::assertArrayNotHasKey(
|
||||
'grantedToV2',
|
||||
$value,
|
||||
$space . ' space should not have any share permissions but found ' . print_r($value, true)
|
||||
$space . ' space should not have any share permissions but found ' . print_r($value, true),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
@@ -2041,18 +2041,18 @@ class SharingNgContext implements Context {
|
||||
public function userShouldBeAbleToSendTheFollowingSpaceShareInvitationWithAllAllowedPermissionRolesUsingRootEndpointOFTheGraphApi(
|
||||
// @codingStandardsIgnoreEnd
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$listPermissionResponse = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||
if (!isset($listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'})) {
|
||||
Assert::fail(
|
||||
"The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n"
|
||||
. $listPermissionResponse
|
||||
. $listPermissionResponse,
|
||||
);
|
||||
}
|
||||
Assert::assertNotEmpty(
|
||||
$listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'},
|
||||
"'@libre.graph.permissions.roles.allowedValues' should not be empty"
|
||||
"'@libre.graph.permissions.roles.allowedValues' should not be empty",
|
||||
);
|
||||
$allowedPermissionRoles = $listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'};
|
||||
// this info is needed for log to see which roles allowed and which were not when tests fail
|
||||
@@ -2069,10 +2069,10 @@ class SharingNgContext implements Context {
|
||||
$roleAllowed = GraphHelper::getPermissionNameByPermissionRoleId($role->id);
|
||||
$responseSendInvitation = $this->sendDriveShareInvitation(
|
||||
$user,
|
||||
new TableNode(array_merge($table->getTable(), [['permissionsRole', $roleAllowed]]))
|
||||
new TableNode(array_merge($table->getTable(), [['permissionsRole', $roleAllowed]])),
|
||||
);
|
||||
$jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent(
|
||||
$responseSendInvitation
|
||||
$responseSendInvitation,
|
||||
);
|
||||
$httpsStatusCode = $responseSendInvitation->getStatusCode();
|
||||
if ($httpsStatusCode === 200 && !empty($jsonResponseSendInvitation->value)) {
|
||||
@@ -2101,7 +2101,7 @@ class SharingNgContext implements Context {
|
||||
public function userTriesToListThePermissionsOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
string $space,
|
||||
string $spaceOwner
|
||||
string $spaceOwner,
|
||||
): void {
|
||||
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
|
||||
|
||||
@@ -2109,7 +2109,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId
|
||||
$spaceId,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -2124,10 +2124,10 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function userRemovesTheLastLinkShareOfSpaceUsingPermissionsEndpointOfGraphApi(
|
||||
string $user,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->removeAccessToSpaceItem($user, 'link', $space, '')
|
||||
$this->removeAccessToSpaceItem($user, 'link', $space, ''),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2152,7 +2152,7 @@ class SharingNgContext implements Context {
|
||||
string $space = '',
|
||||
bool $shouldExist = true,
|
||||
bool $federatedShare = false,
|
||||
string $role = ''
|
||||
string $role = '',
|
||||
): void {
|
||||
$share = \ltrim($share, "/");
|
||||
$wasOrNot = $shouldExist ? "was not" : "was";
|
||||
@@ -2168,7 +2168,7 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$sharee,
|
||||
$this->featureContext->getPasswordForUser($sharee),
|
||||
""
|
||||
"",
|
||||
);
|
||||
$driveList = HttpRequestHelper::getJsonDecodedResponseBodyContent($response)->value;
|
||||
$foundShareMountpoint = false;
|
||||
@@ -2183,7 +2183,7 @@ class SharingNgContext implements Context {
|
||||
Assert::assertSame(
|
||||
$shouldExist,
|
||||
$foundShareMountpoint,
|
||||
"Share mountpoint '$share' $wasOrNot found in the following drives list.\n" . json_encode($driveList)
|
||||
"Share mountpoint '$share' $wasOrNot found in the following drives list.\n" . json_encode($driveList),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2191,7 +2191,7 @@ class SharingNgContext implements Context {
|
||||
$response = GraphHelper::getSharesSharedWithMe(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$sharee,
|
||||
$this->featureContext->getPasswordForUser($sharee)
|
||||
$this->featureContext->getPasswordForUser($sharee),
|
||||
);
|
||||
$sharedWithMeList = HttpRequestHelper::getJsonDecodedResponseBodyContent($response)->value;
|
||||
$foundShareInSharedWithMe = false;
|
||||
@@ -2207,7 +2207,7 @@ class SharingNgContext implements Context {
|
||||
Assert::assertSame(
|
||||
$role,
|
||||
$actualRole,
|
||||
"Expected role '$role' for share '$share' but found '$actualRole'."
|
||||
"Expected role '$role' for share '$share' but found '$actualRole'.",
|
||||
);
|
||||
}
|
||||
break;
|
||||
@@ -2219,7 +2219,7 @@ class SharingNgContext implements Context {
|
||||
Assert::assertSame(
|
||||
$shouldExist,
|
||||
$foundShareInSharedWithMe,
|
||||
"Share '$share' $wasOrNot found in the shared-with-me list.\n" . json_encode($sharedWithMeList)
|
||||
"Share '$share' $wasOrNot found in the shared-with-me list.\n" . json_encode($sharedWithMeList),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2239,7 +2239,7 @@ class SharingNgContext implements Context {
|
||||
string $shouldOrNot,
|
||||
string $share,
|
||||
string $sharer,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$this->checkIfShareExists($share, $sharee, $sharer, $space, $shouldOrNot === "should");
|
||||
}
|
||||
@@ -2287,7 +2287,7 @@ class SharingNgContext implements Context {
|
||||
string $shouldOrNot,
|
||||
string $share,
|
||||
string $sharer,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$this->checkIfShareExists($share, $sharee, $sharer, $space, $shouldOrNot === "should", true);
|
||||
}
|
||||
@@ -2308,7 +2308,7 @@ class SharingNgContext implements Context {
|
||||
string $space,
|
||||
string $sharee,
|
||||
string $role,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$rows = $table->getRows();
|
||||
foreach ($rows as $row) {
|
||||
@@ -2336,7 +2336,7 @@ class SharingNgContext implements Context {
|
||||
*/
|
||||
public function theJsonResponseShouldOrShouldNotContainTheFollowingShares(
|
||||
string $shouldOrNot,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||
|
||||
@@ -2355,12 +2355,12 @@ class SharingNgContext implements Context {
|
||||
if ($shouldOrNot === "should not") {
|
||||
Assert::assertFalse(
|
||||
\in_array($expectedShare, $resourceNames),
|
||||
"The share '$expectedShare' was found in the response."
|
||||
"The share '$expectedShare' was found in the response.",
|
||||
);
|
||||
} else {
|
||||
Assert::assertTrue(
|
||||
\in_array($expectedShare, $resourceNames),
|
||||
"The share '$expectedShare' was not found in the response."
|
||||
"The share '$expectedShare' was not found in the response.",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2381,11 +2381,11 @@ class SharingNgContext implements Context {
|
||||
string $user,
|
||||
string $resource,
|
||||
string $space,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$query = implode('&', $table->getColumn(0));
|
||||
$this->featureContext->setResponse(
|
||||
$this->getPermissionsList($user, $space, $resource, $query)
|
||||
$this->getPermissionsList($user, $space, $resource, $query),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2403,7 +2403,7 @@ class SharingNgContext implements Context {
|
||||
public function userGetsAllTheSharesOfTheResource(
|
||||
string $user,
|
||||
string $resource,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$permission = $this->getPermissionsList($user, "Shares", $resource);
|
||||
$jsonBody = $this->featureContext->getJsonDecodedResponseBodyContent($permission);
|
||||
@@ -2465,7 +2465,7 @@ class SharingNgContext implements Context {
|
||||
Assert::assertSame(
|
||||
$lastShareId,
|
||||
$share['id'],
|
||||
"Link share id is not the same. Expected '$lastShareId' but found '$share[id]'"
|
||||
"Link share id is not the same. Expected '$lastShareId' but found '$share[id]'",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -65,7 +65,7 @@ class SpacesTUSContext implements Context {
|
||||
string $user,
|
||||
string $source,
|
||||
string $destination,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||
$response = $this->tusContext->uploadFileUsingTus($user, $source, $destination, $spaceId);
|
||||
@@ -73,7 +73,7 @@ class SpacesTUSContext implements Context {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
["201", "204"],
|
||||
"HTTP status code was not 201 or 204 while trying to upload file '$destination' for user '$user'",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class SpacesTUSContext implements Context {
|
||||
string $user,
|
||||
string $source,
|
||||
string $destination,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||
try {
|
||||
@@ -107,7 +107,7 @@ class SpacesTUSContext implements Context {
|
||||
Assert::fail(
|
||||
__METHOD__ .
|
||||
" - Expected an exception, but the upload was successful. Status: " .
|
||||
$response->getStatusCode()
|
||||
$response->getStatusCode(),
|
||||
);
|
||||
} catch (ClientException $e) {
|
||||
if (!\str_contains($e->getMessage(), "403 Forbidden")) {
|
||||
@@ -132,7 +132,7 @@ class SpacesTUSContext implements Context {
|
||||
string $user,
|
||||
string $source,
|
||||
string $destination,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||
$response = $this->tusContext->uploadFileUsingTus($user, $source, $destination, $spaceId);
|
||||
@@ -153,7 +153,7 @@ class SpacesTUSContext implements Context {
|
||||
public function thePublicUploadsFileViaTusInsideLastSharedFolderWithPasswordUsingTheWebdavApi(
|
||||
string $source,
|
||||
string $destination,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$response = $this->tusContext->publicUploadFileUsingTus($source, $destination, $password);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
@@ -175,7 +175,7 @@ class SpacesTUSContext implements Context {
|
||||
public function userHasCreatedANewTusResourceForTheSpaceUsingTheWebdavApiWithTheseHeaders(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
TableNode $headers
|
||||
TableNode $headers,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||
$response = $this->tusContext->createNewTUSResourceWithHeaders($user, $headers, '', $spaceId);
|
||||
@@ -199,7 +199,7 @@ class SpacesTUSContext implements Context {
|
||||
string $user,
|
||||
string $spaceName,
|
||||
string $content,
|
||||
TableNode $headers
|
||||
TableNode $headers,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||
$response = $this->tusContext->createNewTUSResourceWithHeaders($user, $headers, $content, $spaceId);
|
||||
@@ -221,7 +221,7 @@ class SpacesTUSContext implements Context {
|
||||
string $user,
|
||||
string $content,
|
||||
string $resource,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): ResponseInterface {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||
$tmpFile = $this->tusContext->writeDataToTempFile($content);
|
||||
@@ -229,7 +229,7 @@ class SpacesTUSContext implements Context {
|
||||
$user,
|
||||
\basename($tmpFile),
|
||||
$resource,
|
||||
$spaceId
|
||||
$spaceId,
|
||||
);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
\unlink($tmpFile);
|
||||
@@ -251,7 +251,7 @@ class SpacesTUSContext implements Context {
|
||||
string $user,
|
||||
string $content,
|
||||
string $file,
|
||||
string $destination
|
||||
string $destination,
|
||||
): void {
|
||||
$remoteItemId = $this->spacesContext->getSharesRemoteItemId($user, $destination);
|
||||
$remoteItemId = \rawurlencode($remoteItemId);
|
||||
@@ -260,7 +260,7 @@ class SpacesTUSContext implements Context {
|
||||
$user,
|
||||
\basename($tmpFile),
|
||||
$file,
|
||||
$remoteItemId
|
||||
$remoteItemId,
|
||||
);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
\unlink($tmpFile);
|
||||
@@ -282,7 +282,7 @@ class SpacesTUSContext implements Context {
|
||||
string $user,
|
||||
string $content,
|
||||
string $resource,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): void {
|
||||
$isSpacesDavPathVersion = $this->featureContext->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES;
|
||||
$resource = \ltrim($resource, "/");
|
||||
@@ -309,13 +309,13 @@ class SpacesTUSContext implements Context {
|
||||
string $user,
|
||||
string $content,
|
||||
string $resource,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): void {
|
||||
$response = $this->uploadFileViaTus($user, $content, $resource, $spaceName);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
["201", "204"],
|
||||
"HTTP status code was not 201 or 204 while trying to upload file '$resource' for user '$user'",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ class SpacesTUSContext implements Context {
|
||||
string $source,
|
||||
string $destination,
|
||||
string $mtime,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): void {
|
||||
switch ($mtime) {
|
||||
case "today":
|
||||
@@ -367,7 +367,7 @@ class SpacesTUSContext implements Context {
|
||||
$source,
|
||||
$destination,
|
||||
$spaceId,
|
||||
['mtime' => $mtime]
|
||||
['mtime' => $mtime],
|
||||
);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -392,7 +392,7 @@ class SpacesTUSContext implements Context {
|
||||
string $checksum,
|
||||
string $offset,
|
||||
string $content,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): void {
|
||||
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
||||
$response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
||||
@@ -418,7 +418,7 @@ class SpacesTUSContext implements Context {
|
||||
string $checksum,
|
||||
string $offset,
|
||||
string $content,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): void {
|
||||
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
||||
$response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
||||
@@ -444,7 +444,7 @@ class SpacesTUSContext implements Context {
|
||||
string $offset,
|
||||
string $data,
|
||||
string $checksum,
|
||||
string $spaceName
|
||||
string $spaceName,
|
||||
): void {
|
||||
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
||||
$response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum);
|
||||
@@ -464,7 +464,7 @@ class SpacesTUSContext implements Context {
|
||||
public function userSendsAChunkToTheLastCreatedTusLocationWithDataInsideOfTheSpaceWithHeaders(
|
||||
string $user,
|
||||
string $data,
|
||||
TableNode $headers
|
||||
TableNode $headers,
|
||||
): void {
|
||||
$rows = $headers->getRowsHash();
|
||||
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
||||
@@ -474,7 +474,7 @@ class SpacesTUSContext implements Context {
|
||||
$rows['Upload-Offset'],
|
||||
$data,
|
||||
$rows['Upload-Checksum'],
|
||||
['Origin' => $rows['Origin']]
|
||||
['Origin' => $rows['Origin']],
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -500,7 +500,7 @@ class SpacesTUSContext implements Context {
|
||||
string $data,
|
||||
string $checksum,
|
||||
string $spaceName,
|
||||
TableNode $headers
|
||||
TableNode $headers,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||
$createResponse = $this->tusContext->createNewTUSResource($user, $headers, $spaceId);
|
||||
@@ -525,7 +525,7 @@ class SpacesTUSContext implements Context {
|
||||
string $user,
|
||||
string $resource,
|
||||
string $spaceName,
|
||||
string $mtime
|
||||
string $mtime,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||
$mtime = new DateTime($mtime);
|
||||
@@ -538,7 +538,7 @@ class SpacesTUSContext implements Context {
|
||||
$resource,
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
$spaceId,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class TUSContext implements Context {
|
||||
string $user,
|
||||
TableNode $headersTable,
|
||||
string $content = '',
|
||||
?string $spaceId = null
|
||||
?string $spaceId = null,
|
||||
): ResponseInterface {
|
||||
$this->featureContext->verifyTableNodeColumnsCount($headersTable, 2);
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
@@ -117,7 +117,7 @@ class TUSContext implements Context {
|
||||
"files",
|
||||
null,
|
||||
false,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
$locationHeader = $response->getHeader('Location');
|
||||
if (\sizeof($locationHeader) > 0) {
|
||||
@@ -192,7 +192,7 @@ class TUSContext implements Context {
|
||||
string $offset,
|
||||
string $data,
|
||||
string $checksum = '',
|
||||
?array $extraHeaders = null
|
||||
?array $extraHeaders = null,
|
||||
): ResponseInterface {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$password = $this->featureContext->getUserPassword($user);
|
||||
@@ -210,7 +210,7 @@ class TUSContext implements Context {
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$data
|
||||
$data,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ class TUSContext implements Context {
|
||||
array $uploadMetadata = [],
|
||||
int $noOfChunks = 1,
|
||||
int $bytes = null,
|
||||
string $checksum = ''
|
||||
string $checksum = '',
|
||||
): void {
|
||||
$response = $this->uploadFileUsingTus(
|
||||
$user,
|
||||
@@ -270,7 +270,7 @@ class TUSContext implements Context {
|
||||
$uploadMetadata,
|
||||
$noOfChunks,
|
||||
$bytes,
|
||||
$checksum
|
||||
$checksum,
|
||||
);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -330,7 +330,7 @@ class TUSContext implements Context {
|
||||
$sourceFile,
|
||||
$destination,
|
||||
WebDavHelper::getDavPath($davPathVersion, $suffixPath),
|
||||
$uploadMetadata
|
||||
$uploadMetadata,
|
||||
);
|
||||
|
||||
$this->featureContext->pauseUploadDelete();
|
||||
@@ -381,7 +381,7 @@ class TUSContext implements Context {
|
||||
$headers,
|
||||
$sourceFile,
|
||||
$destination,
|
||||
$url
|
||||
$url,
|
||||
);
|
||||
$response = $client->createWithUploadRR("", 0);
|
||||
return $response;
|
||||
@@ -406,14 +406,14 @@ class TUSContext implements Context {
|
||||
string $sourceFile,
|
||||
string $destination,
|
||||
string $path,
|
||||
array $metadata = []
|
||||
array $metadata = [],
|
||||
): TusClient {
|
||||
$client = new TusClient(
|
||||
$baseUrl,
|
||||
[
|
||||
'verify' => false,
|
||||
'headers' => $headers,
|
||||
]
|
||||
],
|
||||
);
|
||||
$client->setApiPath($path);
|
||||
$client->setMetadata($metadata);
|
||||
@@ -436,13 +436,13 @@ class TUSContext implements Context {
|
||||
public function userUploadsAFileWithContentToUsingTus(
|
||||
string $user,
|
||||
string $content,
|
||||
string $destination
|
||||
string $destination,
|
||||
): void {
|
||||
$temporaryFileName = $this->writeDataToTempFile($content);
|
||||
$response = $this->uploadFileUsingTus(
|
||||
$user,
|
||||
\basename($temporaryFileName),
|
||||
$destination
|
||||
$destination,
|
||||
);
|
||||
\unlink($temporaryFileName);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -469,7 +469,7 @@ class TUSContext implements Context {
|
||||
?string $user,
|
||||
string $content,
|
||||
?int $noOfChunks,
|
||||
string $destination
|
||||
string $destination,
|
||||
): void {
|
||||
$temporaryFileName = $this->writeDataToTempFile($content);
|
||||
$response = $this->uploadFileUsingTus(
|
||||
@@ -478,7 +478,7 @@ class TUSContext implements Context {
|
||||
$destination,
|
||||
null,
|
||||
[],
|
||||
$noOfChunks
|
||||
$noOfChunks,
|
||||
);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
\unlink($temporaryFileName);
|
||||
@@ -501,7 +501,7 @@ class TUSContext implements Context {
|
||||
string $user,
|
||||
string $source,
|
||||
string $destination,
|
||||
string $mtime
|
||||
string $mtime,
|
||||
): void {
|
||||
$mtime = new DateTime($mtime);
|
||||
$mtime = $mtime->format('U');
|
||||
@@ -511,13 +511,13 @@ class TUSContext implements Context {
|
||||
$source,
|
||||
$destination,
|
||||
null,
|
||||
['mtime' => $mtime]
|
||||
['mtime' => $mtime],
|
||||
);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
["201", "204"],
|
||||
"Failed to upload file '$source' for user '$user'",
|
||||
$response
|
||||
$response,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ class TUSContext implements Context {
|
||||
string $user,
|
||||
string $source,
|
||||
string $destination,
|
||||
string $mtime
|
||||
string $mtime,
|
||||
): void {
|
||||
$mtime = new DateTime($mtime);
|
||||
$mtime = $mtime->format('U');
|
||||
@@ -547,7 +547,7 @@ class TUSContext implements Context {
|
||||
$source,
|
||||
$destination,
|
||||
null,
|
||||
['mtime' => $mtime]
|
||||
['mtime' => $mtime],
|
||||
);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -562,7 +562,7 @@ class TUSContext implements Context {
|
||||
public function writeDataToTempFile(string $content): string {
|
||||
$temporaryFileName = \tempnam(
|
||||
$this->featureContext->acceptanceTestsDirLocation(),
|
||||
"tus-upload-test-"
|
||||
"tus-upload-test-",
|
||||
);
|
||||
if ($temporaryFileName === false) {
|
||||
throw new \Exception("could not create a temporary filename");
|
||||
@@ -606,7 +606,7 @@ class TUSContext implements Context {
|
||||
public function userCreatesWithUpload(
|
||||
string $user,
|
||||
string $content,
|
||||
TableNode $headers
|
||||
TableNode $headers,
|
||||
): void {
|
||||
$response = $this->createNewTUSResourceWithHeaders($user, $headers, $content);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -625,7 +625,7 @@ class TUSContext implements Context {
|
||||
public function userUploadsWithCreatesWithUpload(
|
||||
string $user,
|
||||
string $source,
|
||||
string $content
|
||||
string $content,
|
||||
): void {
|
||||
$temporaryFileName = $this->writeDataToTempFile($content);
|
||||
$response = $this->uploadFileUsingTus(
|
||||
@@ -635,7 +635,7 @@ class TUSContext implements Context {
|
||||
null,
|
||||
[],
|
||||
1,
|
||||
-1
|
||||
-1,
|
||||
);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
\unlink($temporaryFileName);
|
||||
@@ -657,7 +657,7 @@ class TUSContext implements Context {
|
||||
string $user,
|
||||
string $checksum,
|
||||
string $offset,
|
||||
string $content
|
||||
string $content,
|
||||
): void {
|
||||
$resourceLocation = $this->getLastTusResourceLocation();
|
||||
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
||||
@@ -684,7 +684,7 @@ class TUSContext implements Context {
|
||||
string $checksum,
|
||||
string $offset,
|
||||
string $locationIndex,
|
||||
string $filename
|
||||
string $filename,
|
||||
): void {
|
||||
$filenameHash = \base64_encode($filename);
|
||||
$resourceLocation = $this->getTusResourceLocation($filenameHash, (int)$locationIndex);
|
||||
@@ -707,7 +707,7 @@ class TUSContext implements Context {
|
||||
string $user,
|
||||
string $checksum,
|
||||
string $offset,
|
||||
string $content
|
||||
string $content,
|
||||
): void {
|
||||
$resourceLocation = $this->getLastTusResourceLocation();
|
||||
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
||||
@@ -729,7 +729,7 @@ class TUSContext implements Context {
|
||||
string $user,
|
||||
string $offset,
|
||||
string $data,
|
||||
string $checksum
|
||||
string $checksum,
|
||||
): void {
|
||||
$resourceLocation = $this->getLastTusResourceLocation();
|
||||
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum);
|
||||
@@ -751,7 +751,7 @@ class TUSContext implements Context {
|
||||
string $user,
|
||||
string $offset,
|
||||
string $data,
|
||||
string $checksum
|
||||
string $checksum,
|
||||
): void {
|
||||
$resourceLocation = $this->getLastTusResourceLocation();
|
||||
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum);
|
||||
@@ -778,7 +778,7 @@ class TUSContext implements Context {
|
||||
string $offset,
|
||||
string $data,
|
||||
string $checksum,
|
||||
TableNode $headers
|
||||
TableNode $headers,
|
||||
): void {
|
||||
$createResponse = $this->createNewTUSResource($user, $headers);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $createResponse);
|
||||
|
||||
@@ -69,7 +69,7 @@ class TagContext implements Context {
|
||||
string $fileOrFolder,
|
||||
string $resource,
|
||||
string $space,
|
||||
array $tagNameArray
|
||||
array $tagNameArray,
|
||||
): ResponseInterface {
|
||||
if ($fileOrFolder === 'folder' || $fileOrFolder === 'folders') {
|
||||
$resourceId = $this->spacesContext->getResourceId($user, $space, $resource);
|
||||
@@ -82,7 +82,7 @@ class TagContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$resourceId,
|
||||
$tagNameArray
|
||||
$tagNameArray,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class TagContext implements Context {
|
||||
string $fileOrFolder,
|
||||
string $resource,
|
||||
string $space,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$tagNameArray = [];
|
||||
foreach ($table->getRows() as $value) {
|
||||
@@ -130,7 +130,7 @@ class TagContext implements Context {
|
||||
string $fileOrFolder,
|
||||
string $resource,
|
||||
string $space,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$tagNameArray = [];
|
||||
foreach ($table->getRows() as $value) {
|
||||
@@ -155,7 +155,7 @@ class TagContext implements Context {
|
||||
string $user,
|
||||
string $filesOrFolders,
|
||||
string $space,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ["path", "tagName"]);
|
||||
$rows = $table->getHash();
|
||||
@@ -183,7 +183,7 @@ class TagContext implements Context {
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -200,19 +200,19 @@ class TagContext implements Context {
|
||||
$rows = $table->getRows();
|
||||
foreach ($rows as $row) {
|
||||
$responseArray = $this->featureContext->getJsonDecodedResponse(
|
||||
$this->featureContext->getResponse()
|
||||
$this->featureContext->getResponse(),
|
||||
)['value'];
|
||||
if ($shouldOrNot === "not") {
|
||||
Assert::assertFalse(
|
||||
\in_array($row[0], $responseArray),
|
||||
"the response should not contain the tag $row[0].\nResponse\n"
|
||||
. print_r($responseArray, true)
|
||||
. print_r($responseArray, true),
|
||||
);
|
||||
} else {
|
||||
Assert::assertTrue(
|
||||
\in_array($row[0], $responseArray),
|
||||
"the response does not contain the tag $row[0].\nResponse\n"
|
||||
. print_r($responseArray, true)
|
||||
. print_r($responseArray, true),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -233,7 +233,7 @@ class TagContext implements Context {
|
||||
string $fileOrFolder,
|
||||
string $resource,
|
||||
string $space,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): ResponseInterface {
|
||||
$tagNameArray = [];
|
||||
foreach ($table->getRows() as $value) {
|
||||
@@ -251,7 +251,7 @@ class TagContext implements Context {
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$resourceId,
|
||||
$tagNameArray
|
||||
$tagNameArray,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -272,14 +272,14 @@ class TagContext implements Context {
|
||||
string $fileOrFolder,
|
||||
string $resource,
|
||||
string $space,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$response = $this->removeTagsFromResourceOfTheSpace(
|
||||
$user,
|
||||
$fileOrFolder,
|
||||
$resource,
|
||||
$space,
|
||||
$table
|
||||
$table,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -301,7 +301,7 @@ class TagContext implements Context {
|
||||
string $fileOrFolder,
|
||||
string $resource,
|
||||
string $space,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$response = $this->removeTagsFromResourceOfTheSpace($user, $fileOrFolder, $resource, $space, $table);
|
||||
$this->featureContext->theHttpStatusCodeShouldBe(200, "", $response);
|
||||
@@ -324,7 +324,7 @@ class TagContext implements Context {
|
||||
int $numberOfTags,
|
||||
string $fileOrFolder,
|
||||
string $resource,
|
||||
string $space
|
||||
string $space,
|
||||
): void {
|
||||
$tagNames = [];
|
||||
foreach (range(1, $numberOfTags) as $tagNumber) {
|
||||
|
||||
@@ -55,7 +55,7 @@ class TrashbinContext implements Context {
|
||||
null,
|
||||
null,
|
||||
$davPathVersion,
|
||||
'trash-bin'
|
||||
'trash-bin',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class TrashbinContext implements Context {
|
||||
static function (SimpleXMLElement $propStat) {
|
||||
$status = $propStat->xpath('./d:status');
|
||||
return (string) $status[0] === 'HTTP/1.1 200 OK';
|
||||
}
|
||||
},
|
||||
);
|
||||
if (isset($successPropStat[0])) {
|
||||
$successPropStat = $successPropStat[0];
|
||||
@@ -131,7 +131,7 @@ class TrashbinContext implements Context {
|
||||
'original-location' => isset($originalLocation[0]) ? (string) $originalLocation[0] : null,
|
||||
];
|
||||
},
|
||||
$xmlElements
|
||||
$xmlElements,
|
||||
);
|
||||
|
||||
return $files;
|
||||
@@ -174,15 +174,15 @@ class TrashbinContext implements Context {
|
||||
'd:getlastmodified',
|
||||
],
|
||||
'trash-bin',
|
||||
$davPathVersion
|
||||
$davPathVersion,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
|
||||
$files = $this->getTrashbinContentFromResponseXml(
|
||||
HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
)
|
||||
__METHOD__,
|
||||
),
|
||||
);
|
||||
// filter root element
|
||||
$files = \array_filter(
|
||||
@@ -190,7 +190,7 @@ class TrashbinContext implements Context {
|
||||
static function ($element) use ($davPathVersion, $suffixPath) {
|
||||
$davPath = WebDavHelper::getDavPath($davPathVersion, $suffixPath, "trash-bin");
|
||||
return ($element['href'] !== "/" . $davPath . "/");
|
||||
}
|
||||
},
|
||||
);
|
||||
return $files;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ class TrashbinContext implements Context {
|
||||
return $this->listTrashbinFolderCollection(
|
||||
$user,
|
||||
"",
|
||||
$depth
|
||||
$depth,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ class TrashbinContext implements Context {
|
||||
?string $user,
|
||||
?string $collectionPath = "",
|
||||
string $depth = "1",
|
||||
int $level = 1
|
||||
int $level = 1,
|
||||
): array {
|
||||
// $collectionPath should be some list of file-ids like 2147497661/2147497662
|
||||
// or the empty string, which will list the whole trashbin from the top.
|
||||
@@ -249,7 +249,7 @@ class TrashbinContext implements Context {
|
||||
'd:getlastmodified',
|
||||
],
|
||||
'trash-bin',
|
||||
$davPathVersion
|
||||
$davPathVersion,
|
||||
);
|
||||
$response->getBody()->rewind();
|
||||
$statusCode = $response->getStatusCode();
|
||||
@@ -257,14 +257,14 @@ class TrashbinContext implements Context {
|
||||
Assert::assertEquals(
|
||||
"207",
|
||||
$statusCode,
|
||||
"Expected status code to be '207' but got $statusCode \nResponse\n$respBody"
|
||||
"Expected status code to be '207' but got $statusCode \nResponse\n$respBody",
|
||||
);
|
||||
|
||||
$files = $this->getTrashbinContentFromResponseXml(
|
||||
HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__ . " $collectionPath"
|
||||
)
|
||||
__METHOD__ . " $collectionPath",
|
||||
),
|
||||
);
|
||||
|
||||
$suffixPath = $user;
|
||||
@@ -286,7 +286,7 @@ class TrashbinContext implements Context {
|
||||
$path = $path . "/";
|
||||
}
|
||||
return ($element['href'] !== "/$endpoint/$path");
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
foreach ($files as $file) {
|
||||
@@ -302,7 +302,7 @@ class TrashbinContext implements Context {
|
||||
// in the response. That should never happen, or have been filtered out
|
||||
// by the code above.
|
||||
throw new Exception(
|
||||
__METHOD__ . " Error: unexpected href in trashbin propfind at level $level: '$trashbinRef'"
|
||||
__METHOD__ . " Error: unexpected href in trashbin propfind at level $level: '$trashbinRef'",
|
||||
);
|
||||
}
|
||||
if ($file["collection"]) {
|
||||
@@ -313,14 +313,14 @@ class TrashbinContext implements Context {
|
||||
$user,
|
||||
$trashbinId,
|
||||
$depth,
|
||||
$level + 1
|
||||
$level + 1,
|
||||
);
|
||||
// Filter the collection element. We only want the members.
|
||||
$nextFiles = \array_filter(
|
||||
$nextFiles,
|
||||
static function ($element) use ($user, $trashbinRef) {
|
||||
return ($element['href'] !== $trashbinRef);
|
||||
}
|
||||
},
|
||||
);
|
||||
\array_push($files, ...$nextFiles);
|
||||
}
|
||||
@@ -352,7 +352,7 @@ class TrashbinContext implements Context {
|
||||
public function theTrashbinDavResponseShouldNotContainTheseNodes(TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['name']);
|
||||
$files = $this->getTrashbinContentFromResponseXml(
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__)
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__),
|
||||
);
|
||||
|
||||
foreach ($table->getHash() as $row) {
|
||||
@@ -377,7 +377,7 @@ class TrashbinContext implements Context {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['name']);
|
||||
|
||||
$files = $this->getTrashbinContentFromResponseXml(
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__)
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__),
|
||||
);
|
||||
|
||||
foreach ($table->getHash() as $row) {
|
||||
@@ -408,7 +408,7 @@ class TrashbinContext implements Context {
|
||||
public function sendTrashbinListRequest(
|
||||
string $user,
|
||||
?string $asUser = null,
|
||||
?string $password = null
|
||||
?string $password = null,
|
||||
): ResponseInterface {
|
||||
$asUser = $asUser ?? $user;
|
||||
$password = $password ?? $this->featureContext->getPasswordForUser($asUser);
|
||||
@@ -428,7 +428,7 @@ class TrashbinContext implements Context {
|
||||
null,
|
||||
'trash-bin',
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
$asUser
|
||||
$asUser,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ class TrashbinContext implements Context {
|
||||
public function userTriesToListTheTrashbinContentForUserUsingPassword(
|
||||
string $asUser,
|
||||
string $user,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$response = $this->sendTrashbinListRequest($user, $asUser, $password);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -500,7 +500,7 @@ class TrashbinContext implements Context {
|
||||
*/
|
||||
public function theLastWebdavResponseShouldNotContainFollowingElements(TableNode $elements): void {
|
||||
$files = $this->getTrashbinContentFromResponseXml(
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse())
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
||||
);
|
||||
|
||||
// 'user' is also allowed in the table even though it is not used anywhere
|
||||
@@ -553,7 +553,7 @@ class TrashbinContext implements Context {
|
||||
string $user,
|
||||
string $path,
|
||||
string $ofUser,
|
||||
string $password
|
||||
string $password,
|
||||
): void {
|
||||
$response = $this->deleteItemFromTrashbin($user, $path, $ofUser, $password);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -593,7 +593,7 @@ class TrashbinContext implements Context {
|
||||
?string $asUser,
|
||||
?string $path,
|
||||
?string $user,
|
||||
?string $password
|
||||
?string $password,
|
||||
): void {
|
||||
$asUser = $this->featureContext->getActualUsername($asUser);
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
@@ -627,7 +627,7 @@ class TrashbinContext implements Context {
|
||||
*/
|
||||
public function userTriesToDeleteFileWithOriginalPathFromTrashbinUsingTrashbinAPI(
|
||||
string $user,
|
||||
string $originalPath
|
||||
string $originalPath,
|
||||
): void {
|
||||
$response = $this->deleteItemFromTrashbin($user, $originalPath);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -645,7 +645,7 @@ class TrashbinContext implements Context {
|
||||
string $user,
|
||||
string $originalPath,
|
||||
?string $ofUser = null,
|
||||
?string $password = null
|
||||
?string $password = null,
|
||||
): ResponseInterface {
|
||||
$ofUser = $ofUser ?? $user;
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
@@ -668,7 +668,7 @@ class TrashbinContext implements Context {
|
||||
if ($path === "") {
|
||||
throw new Exception(
|
||||
__METHOD__
|
||||
. " could not find the trashbin entry for original path '$originalPath' of user '$user'"
|
||||
. " could not find the trashbin entry for original path '$originalPath' of user '$user'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -679,7 +679,7 @@ class TrashbinContext implements Context {
|
||||
$fullUrl,
|
||||
"DELETE",
|
||||
$user,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ class TrashbinContext implements Context {
|
||||
|
||||
Assert::assertNotNull(
|
||||
$firstEntry,
|
||||
"The first trash entry was not found while looking for trashbin entry '$path' of user '$user'"
|
||||
"The first trash entry was not found while looking for trashbin entry '$path' of user '$user'",
|
||||
);
|
||||
|
||||
if (\count($sections) !== 1) {
|
||||
@@ -779,7 +779,7 @@ class TrashbinContext implements Context {
|
||||
Assert::assertTrue(
|
||||
$found,
|
||||
__METHOD__
|
||||
. " Could not find expected resource '$path' in the trash"
|
||||
. " Could not find expected resource '$path' in the trash",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -822,7 +822,7 @@ class TrashbinContext implements Context {
|
||||
string $trashItemHRef,
|
||||
string $destinationPath,
|
||||
?string $asUser = null,
|
||||
?string $password = null
|
||||
?string $password = null,
|
||||
): ResponseInterface {
|
||||
$asUser = $asUser ?? $user;
|
||||
$password = $password ?? $this->featureContext->getPasswordForUser($asUser);
|
||||
@@ -860,7 +860,7 @@ class TrashbinContext implements Context {
|
||||
false,
|
||||
$password,
|
||||
[],
|
||||
$asUser
|
||||
$asUser,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -880,7 +880,7 @@ class TrashbinContext implements Context {
|
||||
string $originalPath,
|
||||
?string $destinationPath = null,
|
||||
?string $asUser = null,
|
||||
?string $password = null
|
||||
?string $password = null,
|
||||
): ResponseInterface {
|
||||
$asUser = $asUser ?? $user;
|
||||
$listing = $this->listTrashbinFolder($user);
|
||||
@@ -895,7 +895,7 @@ class TrashbinContext implements Context {
|
||||
$entry['href'],
|
||||
$destinationPath,
|
||||
$asUser,
|
||||
$password
|
||||
$password,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -904,7 +904,8 @@ class TrashbinContext implements Context {
|
||||
// is also no up-to-date response to examine in later test steps.
|
||||
throw new \Exception(
|
||||
__METHOD__
|
||||
. " cannot restore from trashbin because no element was found for user $user at original path $originalPath"
|
||||
. " cannot restore from trashbin."
|
||||
. " No element was found for user $user at original path $originalPath",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -919,7 +920,7 @@ class TrashbinContext implements Context {
|
||||
*/
|
||||
public function userRestoresResourceWithOriginalPathWithoutSpecifyingDestinationUsingTrashbinApi(
|
||||
string $user,
|
||||
string $originalPath
|
||||
string $originalPath,
|
||||
): void {
|
||||
$listing = $this->listTrashbinFolder($user);
|
||||
$originalPath = \trim($originalPath, '/');
|
||||
@@ -935,8 +936,8 @@ class TrashbinContext implements Context {
|
||||
[],
|
||||
null,
|
||||
null,
|
||||
'trash-bin'
|
||||
)
|
||||
'trash-bin',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -961,7 +962,7 @@ class TrashbinContext implements Context {
|
||||
?string $fileName,
|
||||
?string $user,
|
||||
?string $content,
|
||||
?string $alternativeContent
|
||||
?string $alternativeContent,
|
||||
): void {
|
||||
$isInTrash = $this->isInTrash($user, $fileName);
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
@@ -1039,7 +1040,7 @@ class TrashbinContext implements Context {
|
||||
public function userRestoresTheFileWithOriginalPathToUsingTheTrashbinApi(
|
||||
?string $user,
|
||||
?string $originalPath,
|
||||
?string $destinationPath
|
||||
?string $destinationPath,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$this->featureContext->setResponse($this->restoreElement($user, $originalPath, $destinationPath));
|
||||
@@ -1057,12 +1058,12 @@ class TrashbinContext implements Context {
|
||||
*/
|
||||
public function elementIsInTrashCheckingOriginalPath(
|
||||
?string $user,
|
||||
?string $originalPath
|
||||
?string $originalPath,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
Assert::assertTrue(
|
||||
$this->isInTrash($user, $originalPath),
|
||||
"File previously located at $originalPath wasn't found in the trashbin of user $user"
|
||||
"File previously located at $originalPath wasn't found in the trashbin of user $user",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1077,12 +1078,12 @@ class TrashbinContext implements Context {
|
||||
*/
|
||||
public function elementIsNotInTrashCheckingOriginalPath(
|
||||
?string $user,
|
||||
string $originalPath
|
||||
string $originalPath,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
Assert::assertFalse(
|
||||
$this->isInTrash($user, $originalPath),
|
||||
"File previously located at $originalPath was found in the trashbin of user $user"
|
||||
"File previously located at $originalPath was found in the trashbin of user $user",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1097,7 +1098,7 @@ class TrashbinContext implements Context {
|
||||
*/
|
||||
public function followingElementsAreNotInTrashCheckingOriginalPath(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ["path"]);
|
||||
$paths = $table->getHash();
|
||||
@@ -1106,7 +1107,7 @@ class TrashbinContext implements Context {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
Assert::assertFalse(
|
||||
$this->isInTrash($user, $originalPath["path"]),
|
||||
"File previously located at " . $originalPath["path"] . " was found in the trashbin of user $user"
|
||||
"File previously located at " . $originalPath["path"] . " was found in the trashbin of user $user",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1122,7 +1123,7 @@ class TrashbinContext implements Context {
|
||||
*/
|
||||
public function followingElementsAreInTrashCheckingOriginalPath(
|
||||
string $user,
|
||||
TableNode $table
|
||||
TableNode $table,
|
||||
): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ["path"]);
|
||||
$paths = $table->getHash();
|
||||
@@ -1131,7 +1132,7 @@ class TrashbinContext implements Context {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
Assert::assertTrue(
|
||||
$this->isInTrash($user, $originalPath["path"]),
|
||||
"File previously located at " . $originalPath["path"] . " wasn't found in the trashbin of user $user"
|
||||
"File previously located at " . $originalPath["path"] . " wasn't found in the trashbin of user $user",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1183,7 +1184,7 @@ class TrashbinContext implements Context {
|
||||
*/
|
||||
public function theDeletedFileFolderShouldHaveCorrectDeletionMtimeInTheResponse(string $resource): void {
|
||||
$files = $this->getTrashbinContentFromResponseXml(
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse())
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
||||
);
|
||||
|
||||
$found = false;
|
||||
@@ -1203,7 +1204,7 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
Assert::assertTrue(
|
||||
$found,
|
||||
"$resource expected to be listed in response with mtime '$expectedMtime' but found '$responseMtime'"
|
||||
"$resource expected to be listed in response with mtime '$expectedMtime' but found '$responseMtime'",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,7 @@ class WebDavLockingContext implements Context {
|
||||
string $fullUrl = null,
|
||||
bool $public = false,
|
||||
bool $expectToSucceed = true,
|
||||
?string $spaceId = null
|
||||
?string $spaceId = null,
|
||||
): ResponseInterface {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
if ($public === true) {
|
||||
@@ -102,7 +102,7 @@ class WebDavLockingContext implements Context {
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$headers,
|
||||
$body
|
||||
$body,
|
||||
);
|
||||
} else {
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
@@ -116,7 +116,7 @@ class WebDavLockingContext implements Context {
|
||||
$spaceId,
|
||||
$body,
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
$type
|
||||
$type,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class WebDavLockingContext implements Context {
|
||||
public function userLocksFileSettingPropertiesUsingWebDavAPI(
|
||||
string $user,
|
||||
string $file,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$spaceId = null;
|
||||
if (\str_starts_with($file, "Shares/")
|
||||
@@ -169,7 +169,7 @@ class WebDavLockingContext implements Context {
|
||||
public function userTriesToLockFileSettingPropertiesUsingWebDavAPI(
|
||||
string $user,
|
||||
string $file,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$response = $this->lockFile($user, $file, $properties, null, false, false);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -190,7 +190,7 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $space,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$this->featureContext->setResponse($this->userLocksFileInProjectSpace($user, $file, $space, $properties));
|
||||
}
|
||||
@@ -209,7 +209,7 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $space,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): ?ResponseInterface {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
@@ -239,7 +239,7 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $space,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$response = $this->userLocksFileInProjectSpace($user, $file, $space, $properties);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
@@ -259,7 +259,7 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $space,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
|
||||
$davPathVersion = $this->featureContext->getDavPathVersion();
|
||||
@@ -288,7 +288,7 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $fileId,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
||||
$davPath = \rtrim($davPath, '/');
|
||||
@@ -311,7 +311,7 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $fileId,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
||||
$davPath = \rtrim($davPath, '/');
|
||||
@@ -348,7 +348,7 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $spaceName,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName);
|
||||
$response = $this->lockFile($user, $file, $properties, null, false, true, $spaceId);
|
||||
@@ -369,7 +369,7 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $file,
|
||||
string $fileId,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
||||
$davPath = \rtrim($davPath, '/');
|
||||
@@ -391,7 +391,7 @@ class WebDavLockingContext implements Context {
|
||||
"/",
|
||||
$properties,
|
||||
null,
|
||||
true
|
||||
true,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
}
|
||||
@@ -414,7 +414,7 @@ class WebDavLockingContext implements Context {
|
||||
$properties,
|
||||
null,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -429,7 +429,7 @@ class WebDavLockingContext implements Context {
|
||||
*/
|
||||
public function publicHasLockedFileLastSharedFolder(
|
||||
string $file,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$token = ($this->featureContext->isUsingSharingNG())
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
@@ -439,7 +439,7 @@ class WebDavLockingContext implements Context {
|
||||
$file,
|
||||
$properties,
|
||||
null,
|
||||
true
|
||||
true,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ class WebDavLockingContext implements Context {
|
||||
*/
|
||||
public function publicLocksFileLastSharedFolder(
|
||||
string $file,
|
||||
TableNode $properties
|
||||
TableNode $properties,
|
||||
): void {
|
||||
$token = ($this->featureContext->isUsingSharingNG())
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
@@ -466,7 +466,7 @@ class WebDavLockingContext implements Context {
|
||||
$properties,
|
||||
null,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -484,7 +484,7 @@ class WebDavLockingContext implements Context {
|
||||
$user,
|
||||
$file,
|
||||
$user,
|
||||
$file
|
||||
$file,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -501,7 +501,7 @@ class WebDavLockingContext implements Context {
|
||||
public function userUnlocksTheLastCreatedLockOfFileInsideSpaceUsingTheWebdavApi(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
string $file
|
||||
string $file,
|
||||
): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName);
|
||||
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||
@@ -511,7 +511,7 @@ class WebDavLockingContext implements Context {
|
||||
$file,
|
||||
false,
|
||||
null,
|
||||
$spaceId
|
||||
$spaceId,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -528,7 +528,7 @@ class WebDavLockingContext implements Context {
|
||||
public function userUnlocksTheLastCreatedLockOfFileWithFileIdPathUsingTheWebdavApi(
|
||||
string $user,
|
||||
string $itemToUnlock,
|
||||
string $fileId
|
||||
string $fileId,
|
||||
): void {
|
||||
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
||||
$davPath = \rtrim($davPath, '/');
|
||||
@@ -539,7 +539,7 @@ class WebDavLockingContext implements Context {
|
||||
$user,
|
||||
$itemToUnlock,
|
||||
false,
|
||||
$fullUrl
|
||||
$fullUrl,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -556,13 +556,13 @@ class WebDavLockingContext implements Context {
|
||||
public function unlockItemWithLastLockOfOtherItemUsingWebDavAPI(
|
||||
string $user,
|
||||
string $itemToUnlock,
|
||||
string $itemToUseLockOf
|
||||
string $itemToUseLockOf,
|
||||
): void {
|
||||
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||
$user,
|
||||
$itemToUnlock,
|
||||
$user,
|
||||
$itemToUseLockOf
|
||||
$itemToUseLockOf,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -579,14 +579,14 @@ class WebDavLockingContext implements Context {
|
||||
public function unlockItemWithLastPublicLockOfOtherItemUsingWebDavAPI(
|
||||
string $user,
|
||||
string $itemToUnlock,
|
||||
string $itemToUseLockOf
|
||||
string $itemToUseLockOf,
|
||||
): void {
|
||||
$lockOwner = $this->featureContext->getLastCreatedPublicShareToken();
|
||||
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||
$user,
|
||||
$itemToUnlock,
|
||||
$lockOwner,
|
||||
$itemToUseLockOf
|
||||
$itemToUseLockOf,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -602,7 +602,7 @@ class WebDavLockingContext implements Context {
|
||||
*/
|
||||
private function countLockOfResources(
|
||||
string $user,
|
||||
string $itemToUnlock
|
||||
string $itemToUnlock,
|
||||
): int {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
@@ -621,7 +621,7 @@ class WebDavLockingContext implements Context {
|
||||
null,
|
||||
null,
|
||||
$body,
|
||||
$this->featureContext->getDavPathVersion()
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||
$xmlPart = $responseXmlObject->xpath("//d:response//d:lockdiscovery/d:activelock");
|
||||
@@ -648,7 +648,7 @@ class WebDavLockingContext implements Context {
|
||||
string $itemToUnlock,
|
||||
string $lockOwner,
|
||||
string $itemToUseLockOf,
|
||||
bool $public = false
|
||||
bool $public = false,
|
||||
): void {
|
||||
$lockCount = $this->countLockOfResources($user, $itemToUnlock);
|
||||
|
||||
@@ -657,7 +657,7 @@ class WebDavLockingContext implements Context {
|
||||
$itemToUnlock,
|
||||
$lockOwner,
|
||||
$itemToUseLockOf,
|
||||
$public
|
||||
$public,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||
|
||||
@@ -666,7 +666,7 @@ class WebDavLockingContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$lockCount - 1,
|
||||
$lockCountAfterUnlock,
|
||||
"Expected $lockCount lock(s) for '$itemToUnlock' but found '$lockCount'"
|
||||
"Expected $lockCount lock(s) for '$itemToUnlock' but found '$lockCount'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -705,7 +705,7 @@ class WebDavLockingContext implements Context {
|
||||
if (!isset($this->tokenOfLastLock[$lockOwner][$itemToUseLockOf])) {
|
||||
Assert::fail(
|
||||
"could not find saved token of '$itemToUseLockOf' " .
|
||||
"owned by user '$lockOwner'"
|
||||
"owned by user '$lockOwner'",
|
||||
);
|
||||
}
|
||||
$headers = [
|
||||
@@ -717,7 +717,7 @@ class WebDavLockingContext implements Context {
|
||||
"UNLOCK",
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
} else {
|
||||
$response = WebDavHelper::makeDavRequest(
|
||||
@@ -730,7 +730,7 @@ class WebDavLockingContext implements Context {
|
||||
$spaceId,
|
||||
null,
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
$type
|
||||
$type,
|
||||
);
|
||||
}
|
||||
return $response;
|
||||
@@ -750,13 +750,13 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $itemToUnlock,
|
||||
string $lockOwner,
|
||||
string $itemToUseLockOf
|
||||
string $itemToUseLockOf,
|
||||
): void {
|
||||
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||
$user,
|
||||
$itemToUnlock,
|
||||
$lockOwner,
|
||||
$itemToUseLockOf
|
||||
$itemToUseLockOf,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -773,7 +773,7 @@ class WebDavLockingContext implements Context {
|
||||
public function unlockItemAsPublicWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||
string $itemToUnlock,
|
||||
string $lockOwner,
|
||||
string $itemToUseLockOf
|
||||
string $itemToUseLockOf,
|
||||
): void {
|
||||
$token = ($this->featureContext->isUsingSharingNG())
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
@@ -783,7 +783,7 @@ class WebDavLockingContext implements Context {
|
||||
$itemToUnlock,
|
||||
$lockOwner,
|
||||
$itemToUseLockOf,
|
||||
true
|
||||
true,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -804,7 +804,7 @@ class WebDavLockingContext implements Context {
|
||||
$itemToUnlock,
|
||||
$token,
|
||||
$itemToUnlock,
|
||||
true
|
||||
true,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -823,14 +823,14 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $fileSource,
|
||||
string $fileDestination,
|
||||
string $itemToUseLockOf
|
||||
string $itemToUseLockOf,
|
||||
): void {
|
||||
$response = $this->moveItemSendingLockTokenOfUser(
|
||||
$user,
|
||||
$fileSource,
|
||||
$fileDestination,
|
||||
$itemToUseLockOf,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -849,13 +849,13 @@ class WebDavLockingContext implements Context {
|
||||
string $fileSource,
|
||||
string $fileDestination,
|
||||
string $itemToUseLockOf,
|
||||
string $lockOwner
|
||||
string $lockOwner,
|
||||
): ResponseInterface {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$lockOwner = $this->featureContext->getActualUsername($lockOwner);
|
||||
$destination = $this->featureContext->destinationHeaderValue(
|
||||
$user,
|
||||
$fileDestination
|
||||
$fileDestination,
|
||||
);
|
||||
$token = $this->tokenOfLastLock[$lockOwner][$itemToUseLockOf];
|
||||
$headers = [
|
||||
@@ -866,7 +866,7 @@ class WebDavLockingContext implements Context {
|
||||
$user,
|
||||
"MOVE",
|
||||
$fileSource,
|
||||
$headers
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -886,14 +886,14 @@ class WebDavLockingContext implements Context {
|
||||
string $fileSource,
|
||||
string $fileDestination,
|
||||
string $itemToUseLockOf,
|
||||
string $lockOwner
|
||||
string $lockOwner,
|
||||
): void {
|
||||
$response = $this->moveItemSendingLockTokenOfUser(
|
||||
$user,
|
||||
$fileSource,
|
||||
$fileDestination,
|
||||
$itemToUseLockOf,
|
||||
$lockOwner
|
||||
$lockOwner,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -912,7 +912,7 @@ class WebDavLockingContext implements Context {
|
||||
string $user,
|
||||
string $content,
|
||||
string $destination,
|
||||
string $itemToUseLockOf
|
||||
string $itemToUseLockOf,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$token = $this->tokenOfLastLock[$user][$itemToUseLockOf];
|
||||
@@ -922,7 +922,7 @@ class WebDavLockingContext implements Context {
|
||||
"PUT",
|
||||
$destination,
|
||||
["If" => "(<$token>)"],
|
||||
$content
|
||||
$content,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||
@@ -943,7 +943,7 @@ class WebDavLockingContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$count,
|
||||
$lockCount,
|
||||
"Expected $count lock(s) for '$file' but found '$lockCount'"
|
||||
"Expected $count lock(s) for '$file' but found '$lockCount'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -973,7 +973,7 @@ class WebDavLockingContext implements Context {
|
||||
int $count,
|
||||
string $file,
|
||||
string $spaceName,
|
||||
string $user
|
||||
string $user,
|
||||
): void {
|
||||
$response = $this->spacesContext->sendPropfindRequestToSpace($user, $spaceName, $file, null, '0');
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||
@@ -987,7 +987,7 @@ class WebDavLockingContext implements Context {
|
||||
Assert::assertEquals(
|
||||
$count,
|
||||
$lockCount,
|
||||
"Expected $count lock(s) for '$file' inside space '$spaceName' but found '$lockCount'"
|
||||
"Expected $count lock(s) for '$file' inside space '$spaceName' but found '$lockCount'",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,12 +55,12 @@ class WebDavPropertiesContext implements Context {
|
||||
*/
|
||||
public function userGetsThePropertiesOfFolder(
|
||||
string $user,
|
||||
string $path
|
||||
string $path,
|
||||
): void {
|
||||
$response = $this->featureContext->listFolder(
|
||||
$user,
|
||||
$path,
|
||||
'0'
|
||||
'0',
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -78,12 +78,12 @@ class WebDavPropertiesContext implements Context {
|
||||
public function userGetsThePropertiesOfFolderWithDepth(
|
||||
string $user,
|
||||
string $path,
|
||||
string $depth
|
||||
string $depth,
|
||||
): void {
|
||||
$response = $this->featureContext->listFolder(
|
||||
$user,
|
||||
$path,
|
||||
$depth
|
||||
$depth,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class WebDavPropertiesContext implements Context {
|
||||
string $user,
|
||||
string $path,
|
||||
?string $spaceId,
|
||||
TableNode $propertiesTable
|
||||
TableNode $propertiesTable,
|
||||
): ResponseInterface {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$properties = null;
|
||||
@@ -132,7 +132,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function userGetsFollowingPropertiesOfEntryUsingWebDavApi(
|
||||
string $user,
|
||||
string $path,
|
||||
TableNode $propertiesTable
|
||||
TableNode $propertiesTable,
|
||||
): void {
|
||||
$response = $this->getPropertiesOfFolder($user, $path, null, $propertiesTable);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -153,7 +153,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$this->featureContext->getCurrentUser(),
|
||||
$path,
|
||||
null,
|
||||
$propertiesTable
|
||||
$propertiesTable,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function userHasSetFollowingPropertiesUsingProppatch(
|
||||
string $username,
|
||||
string $path,
|
||||
TableNode $propertiesTable
|
||||
TableNode $propertiesTable,
|
||||
): void {
|
||||
$username = $this->featureContext->getActualUsername($username);
|
||||
$this->featureContext->verifyTableNodeColumns($propertiesTable, ['propertyName', 'propertyValue']);
|
||||
@@ -184,7 +184,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$this->featureContext->getPasswordForUser($username),
|
||||
$path,
|
||||
$properties,
|
||||
$this->featureContext->getDavPathVersion()
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function userGetsCustomPropertyOfFile(
|
||||
string $user,
|
||||
string $propertyName,
|
||||
string $path
|
||||
string $path,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$properties = [$propertyName];
|
||||
@@ -215,7 +215,7 @@ class WebDavPropertiesContext implements Context {
|
||||
"0",
|
||||
null,
|
||||
"files",
|
||||
$this->featureContext->getDavPathVersion()
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -235,7 +235,7 @@ class WebDavPropertiesContext implements Context {
|
||||
string $user,
|
||||
string $propertyName,
|
||||
string $namespace,
|
||||
string $path
|
||||
string $path,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$properties = [
|
||||
@@ -250,7 +250,7 @@ class WebDavPropertiesContext implements Context {
|
||||
"0",
|
||||
null,
|
||||
"files",
|
||||
$this->featureContext->getDavPathVersion()
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -276,7 +276,7 @@ class WebDavPropertiesContext implements Context {
|
||||
'0',
|
||||
$properties,
|
||||
null,
|
||||
"public-files"
|
||||
"public-files",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ class WebDavPropertiesContext implements Context {
|
||||
*/
|
||||
public function thePublicGetsFollowingPropertiesOfEntryFromLastLinkShare(
|
||||
string $path,
|
||||
TableNode $propertiesTable
|
||||
TableNode $propertiesTable,
|
||||
): void {
|
||||
$response = $this->getPropertiesOfEntryFromLastLinkShare($path, $propertiesTable);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -323,7 +323,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$propertyName,
|
||||
$propertyValue,
|
||||
$namespace,
|
||||
$this->featureContext->getDavPathVersion()
|
||||
$this->featureContext->getDavPathVersion(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -342,13 +342,13 @@ class WebDavPropertiesContext implements Context {
|
||||
string $user,
|
||||
string $propertyName,
|
||||
string $path,
|
||||
string $propertyValue
|
||||
string $propertyValue,
|
||||
): void {
|
||||
$response = $this->setResourceProperty(
|
||||
$user,
|
||||
$propertyName,
|
||||
$path,
|
||||
$propertyValue
|
||||
$propertyValue,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -370,14 +370,14 @@ class WebDavPropertiesContext implements Context {
|
||||
string $propertyName,
|
||||
string $namespace,
|
||||
string $path,
|
||||
string $propertyValue
|
||||
string $propertyValue,
|
||||
): void {
|
||||
$response = $this->setResourceProperty(
|
||||
$user,
|
||||
$propertyName,
|
||||
$path,
|
||||
$propertyValue,
|
||||
$namespace
|
||||
$namespace,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
@@ -397,13 +397,13 @@ class WebDavPropertiesContext implements Context {
|
||||
string $user,
|
||||
string $propertyName,
|
||||
string $path,
|
||||
string $propertyValue
|
||||
string $propertyValue,
|
||||
): void {
|
||||
$response = $this->setResourceProperty(
|
||||
$user,
|
||||
$propertyName,
|
||||
$path,
|
||||
$propertyValue
|
||||
$propertyValue,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||
}
|
||||
@@ -425,14 +425,14 @@ class WebDavPropertiesContext implements Context {
|
||||
string $propertyName,
|
||||
string $namespace,
|
||||
string $path,
|
||||
string $propertyValue
|
||||
string $propertyValue,
|
||||
): void {
|
||||
$response = $this->setResourceProperty(
|
||||
$user,
|
||||
$propertyName,
|
||||
$path,
|
||||
$propertyValue,
|
||||
$namespace
|
||||
$namespace,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||
}
|
||||
@@ -450,21 +450,21 @@ class WebDavPropertiesContext implements Context {
|
||||
$propertyValue = \str_replace('\"', '"', $propertyValue);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$this->featureContext->getResponse(),
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath(
|
||||
"//d:prop/" . "$propertyName"
|
||||
"//d:prop/" . "$propertyName",
|
||||
);
|
||||
Assert::assertArrayHasKey(
|
||||
0,
|
||||
$xmlPart,
|
||||
"Cannot find property \"$propertyName\""
|
||||
"Cannot find property \"$propertyName\"",
|
||||
);
|
||||
Assert::assertEquals(
|
||||
$propertyValue,
|
||||
$xmlPart[0]->__toString(),
|
||||
"\"$propertyName\" has a value \"" .
|
||||
$xmlPart[0]->__toString() . "\" but \"$propertyValue\" expected"
|
||||
$xmlPart[0]->__toString() . "\" but \"$propertyValue\" expected",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -481,32 +481,32 @@ class WebDavPropertiesContext implements Context {
|
||||
public function theResponseShouldContainACustomPropertyWithNamespaceAndValue(
|
||||
string $propertyName,
|
||||
string $namespaceString,
|
||||
string $propertyValue
|
||||
string $propertyValue,
|
||||
): void {
|
||||
// let's unescape quotes first
|
||||
$propertyValue = \str_replace('\"', '"', $propertyValue);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$this->featureContext->getResponse(),
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$ns = WebDavHelper::parseNamespace($namespaceString);
|
||||
$responseXmlObject->registerXPathNamespace(
|
||||
$ns->prefix,
|
||||
$ns->namespace
|
||||
$ns->namespace,
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath(
|
||||
"//d:prop/$propertyName"
|
||||
"//d:prop/$propertyName",
|
||||
);
|
||||
Assert::assertArrayHasKey(
|
||||
0,
|
||||
$xmlPart,
|
||||
"Cannot find property \"$propertyName\""
|
||||
"Cannot find property \"$propertyName\"",
|
||||
);
|
||||
Assert::assertEquals(
|
||||
$propertyValue,
|
||||
$xmlPart[0]->__toString(),
|
||||
"\"$propertyName\" has a value \"" .
|
||||
$xmlPart[0]->__toString() . "\" but \"$propertyValue\" expected"
|
||||
$xmlPart[0]->__toString() . "\" but \"$propertyValue\" expected",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -524,20 +524,20 @@ class WebDavPropertiesContext implements Context {
|
||||
public function theSingleResponseShouldContainAPropertyWithChildProperty(
|
||||
string $property,
|
||||
string $withOrWithout,
|
||||
string $childProperty
|
||||
string $childProperty,
|
||||
): void {
|
||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
||||
"//d:prop/$property/$childProperty"
|
||||
"//d:prop/$property/$childProperty",
|
||||
);
|
||||
if ($withOrWithout === "with") {
|
||||
Assert::assertTrue(
|
||||
isset($xmlPart[0]),
|
||||
"Cannot find property \"$property/$childProperty\""
|
||||
"Cannot find property \"$property/$childProperty\"",
|
||||
);
|
||||
} else {
|
||||
Assert::assertFalse(
|
||||
isset($xmlPart[0]),
|
||||
"Found property \"$property/$childProperty\""
|
||||
"Found property \"$property/$childProperty\"",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -553,7 +553,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function theResponseShouldContainProperty(string $key): void {
|
||||
$this->checkResponseContainsProperty(
|
||||
$this->featureContext->getResponse(),
|
||||
$key
|
||||
$key,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$this->checkResponseContainsProperty(
|
||||
$this->featureContext->getResponse(),
|
||||
$key,
|
||||
$namespace
|
||||
$namespace,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -585,13 +585,13 @@ class WebDavPropertiesContext implements Context {
|
||||
*/
|
||||
public function theSingleResponseShouldContainAPropertyWithValue(
|
||||
string $key,
|
||||
string $expectedValue
|
||||
string $expectedValue,
|
||||
): void {
|
||||
$this->checkResponseContainsAPropertyWithValue(
|
||||
$this->featureContext->getResponse(),
|
||||
$key,
|
||||
$expectedValue,
|
||||
$expectedValue
|
||||
$expectedValue,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -608,14 +608,14 @@ class WebDavPropertiesContext implements Context {
|
||||
public function theSingleResponseAboutTheFileOwnedByShouldContainAPropertyWithValue(
|
||||
string $user,
|
||||
string $key,
|
||||
string $expectedValue
|
||||
string $expectedValue,
|
||||
): void {
|
||||
$this->checkResponseContainsAPropertyWithValue(
|
||||
$this->featureContext->getResponse(),
|
||||
$key,
|
||||
$expectedValue,
|
||||
$expectedValue,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -632,13 +632,13 @@ class WebDavPropertiesContext implements Context {
|
||||
public function theSingleResponseShouldContainAPropertyWithValueAndAlternative(
|
||||
string $key,
|
||||
string $expectedValue,
|
||||
string $altExpectedValue
|
||||
string $altExpectedValue,
|
||||
): void {
|
||||
$this->checkResponseContainsAPropertyWithValue(
|
||||
$this->featureContext->getResponse(),
|
||||
$key,
|
||||
$expectedValue,
|
||||
$altExpectedValue
|
||||
$altExpectedValue,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function checkResponseContainsProperty(
|
||||
ResponseInterface $response,
|
||||
string $key,
|
||||
string $namespaceString = null
|
||||
string $namespaceString = null,
|
||||
): SimpleXMLElement {
|
||||
$xmlPart = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||
;
|
||||
@@ -662,7 +662,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$ns = WebDavHelper::parseNamespace($namespaceString);
|
||||
$xmlPart->registerXPathNamespace(
|
||||
$ns->prefix,
|
||||
$ns->namespace
|
||||
$ns->namespace,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -670,14 +670,14 @@ class WebDavPropertiesContext implements Context {
|
||||
|
||||
Assert::assertTrue(
|
||||
isset($match[0]),
|
||||
"Cannot find property \"$key\""
|
||||
"Cannot find property \"$key\"",
|
||||
);
|
||||
|
||||
$property = \explode(":", $key);
|
||||
$propertyName = $property[\count($property) - 1];
|
||||
Assert::assertEquals(
|
||||
$match[0]->getName(),
|
||||
$propertyName
|
||||
$propertyName,
|
||||
);
|
||||
return $match[0];
|
||||
}
|
||||
@@ -697,13 +697,13 @@ class WebDavPropertiesContext implements Context {
|
||||
string $key,
|
||||
string $expectedValue,
|
||||
string $altExpectedValue,
|
||||
?string $user = null
|
||||
?string $user = null,
|
||||
): void {
|
||||
$xmlPart = $this->checkResponseContainsProperty($response, $key);
|
||||
$value = $xmlPart->__toString();
|
||||
$expectedValue = $this->featureContext->substituteInLineCodes(
|
||||
$expectedValue,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
$expectedValue = "#^$expectedValue$#";
|
||||
$altExpectedValue = "#^$altExpectedValue$#";
|
||||
@@ -712,7 +712,7 @@ class WebDavPropertiesContext implements Context {
|
||||
) {
|
||||
Assert::fail(
|
||||
"Property \"$key\" found with value \"$value\", " .
|
||||
"expected \"$expectedValue\" or \"$altExpectedValue\""
|
||||
"expected \"$expectedValue\" or \"$altExpectedValue\"",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -730,7 +730,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$this->assertValueOfItemInResponseAboutUserIs(
|
||||
$xpath,
|
||||
null,
|
||||
$expectedValue
|
||||
$expectedValue,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$this->assertValueOfItemInResponseAboutUserIs(
|
||||
$fullXpath,
|
||||
null,
|
||||
$expectedValue
|
||||
$expectedValue,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -770,7 +770,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function theValueOfTheItemInTheResponseAboutUserShouldBe(
|
||||
string $xpath,
|
||||
string $user,
|
||||
string $expectedValue
|
||||
string $expectedValue,
|
||||
): void {
|
||||
$this->assertValueOfItemInResponseAboutUserIs($xpath, $user, $expectedValue);
|
||||
}
|
||||
@@ -785,13 +785,13 @@ class WebDavPropertiesContext implements Context {
|
||||
public function assertValueOfItemInResponseAboutUserIs(string $xpath, ?string $user, string $expectedValue): void {
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$this->featureContext->getResponse(),
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$value = $this->getXmlItemByXpath($responseXmlObject, $xpath);
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$expectedValue = $this->featureContext->substituteInLineCodes(
|
||||
$expectedValue,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
|
||||
// The expected value can contain /%base_path%/ which can be empty some time
|
||||
@@ -801,7 +801,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$expectedValue,
|
||||
$value,
|
||||
"item \"$xpath\" found with value \"$value\", " .
|
||||
"expected \"$expectedValue\""
|
||||
"expected \"$expectedValue\"",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -820,25 +820,25 @@ class WebDavPropertiesContext implements Context {
|
||||
string $xpath,
|
||||
?string $user,
|
||||
string $expectedValue1,
|
||||
string $expectedValue2
|
||||
string $expectedValue2,
|
||||
): void {
|
||||
if (!$expectedValue2) {
|
||||
$expectedValue2 = $expectedValue1;
|
||||
}
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$this->featureContext->getResponse(),
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
$value = $this->getXmlItemByXpath($responseXmlObject, $xpath);
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$expectedValue1 = $this->featureContext->substituteInLineCodes(
|
||||
$expectedValue1,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
|
||||
$expectedValue2 = $this->featureContext->substituteInLineCodes(
|
||||
$expectedValue2,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
|
||||
// The expected value can contain /%base_path%/ which can be empty some time
|
||||
@@ -849,7 +849,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$isExpectedValueInMessage = \in_array($value, $expectedValues);
|
||||
Assert::assertTrue(
|
||||
$isExpectedValueInMessage,
|
||||
"The actual value \"$value\" is not one of the expected values: \"$expectedValue1\" or \"$expectedValue2\""
|
||||
"The actual value \"$value\" is not one of the expected values: \"$expectedValue1\" or \"$expectedValue2\"",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -861,12 +861,12 @@ class WebDavPropertiesContext implements Context {
|
||||
*/
|
||||
public function getXmlItemByXpath(
|
||||
SimpleXMLElement $responseXmlObject,
|
||||
string $xpath
|
||||
string $xpath,
|
||||
): string {
|
||||
$xmlPart = $responseXmlObject->xpath($xpath);
|
||||
Assert::assertTrue(
|
||||
isset($xmlPart[0]),
|
||||
"Cannot find item with xpath \"$xpath\""
|
||||
"Cannot find item with xpath \"$xpath\"",
|
||||
);
|
||||
return $xmlPart[0]->__toString();
|
||||
}
|
||||
@@ -884,7 +884,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$this->assertXpathValueMatchesPattern(
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
||||
$xpath,
|
||||
$pattern
|
||||
$pattern,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -901,7 +901,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function publicGetsThePropertiesOfFolderAndAssertValueOfItemInResponseRegExp(
|
||||
string $xpath,
|
||||
string $path,
|
||||
string $pattern
|
||||
string $pattern,
|
||||
): void {
|
||||
$propertiesTable = new TableNode([['propertyName'],['d:lockdiscovery']]);
|
||||
$response = $this->getPropertiesOfEntryFromLastLinkShare($path, $propertiesTable);
|
||||
@@ -909,7 +909,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$this->assertXpathValueMatchesPattern(
|
||||
HttpRequestHelper::getResponseXml($response, __METHOD__),
|
||||
$xpath,
|
||||
$pattern
|
||||
$pattern,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -925,14 +925,14 @@ class WebDavPropertiesContext implements Context {
|
||||
public function assertEntryWithHrefMatchingRegExpInResponseToUser(string $expectedHref, string $user): void {
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$this->featureContext->getResponse(),
|
||||
__METHOD__
|
||||
__METHOD__,
|
||||
);
|
||||
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$expectedHref = $this->featureContext->substituteInLineCodes(
|
||||
$expectedHref,
|
||||
$user,
|
||||
['preg_quote' => ['/']]
|
||||
['preg_quote' => ['/']],
|
||||
);
|
||||
$expectedHref = WebdavHelper::prefixRemotePhp($expectedHref);
|
||||
|
||||
@@ -944,7 +944,7 @@ class WebDavPropertiesContext implements Context {
|
||||
// If we have run out of entries in the response, then fail the test
|
||||
Assert::assertTrue(
|
||||
isset($xmlPart[0]),
|
||||
"Cannot find any entry having href with value $expectedHref in response to $user"
|
||||
"Cannot find any entry having href with value $expectedHref in response to $user",
|
||||
);
|
||||
$value = $xmlPart[0]->__toString();
|
||||
$decodedValue = \rawurldecode($value);
|
||||
@@ -985,12 +985,12 @@ class WebDavPropertiesContext implements Context {
|
||||
SimpleXMLElement $responseXmlObject,
|
||||
string $xpath,
|
||||
string $pattern,
|
||||
?string $user = null
|
||||
?string $user = null,
|
||||
): void {
|
||||
$xmlPart = $responseXmlObject->xpath($xpath);
|
||||
Assert::assertTrue(
|
||||
isset($xmlPart[0]),
|
||||
"Cannot find item with xpath \"$xpath\""
|
||||
"Cannot find item with xpath \"$xpath\"",
|
||||
);
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$value = $xmlPart[0]->__toString();
|
||||
@@ -1015,13 +1015,13 @@ class WebDavPropertiesContext implements Context {
|
||||
[$this->featureContext, $callback],
|
||||
"parameter" => [],
|
||||
],
|
||||
]
|
||||
],
|
||||
);
|
||||
Assert::assertMatchesRegularExpression(
|
||||
$pattern,
|
||||
$value,
|
||||
"item \"$xpath\" found with value \"$value\", " .
|
||||
"expected to match regex pattern: \"$pattern\""
|
||||
"expected to match regex pattern: \"$pattern\"",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1040,21 +1040,21 @@ class WebDavPropertiesContext implements Context {
|
||||
string $user,
|
||||
string $xpath,
|
||||
string $path,
|
||||
string $pattern
|
||||
string $pattern,
|
||||
): void {
|
||||
$propertiesTable = new TableNode([['propertyName'],['d:lockdiscovery']]);
|
||||
$response = $this->getPropertiesOfFolder(
|
||||
$user,
|
||||
$path,
|
||||
null,
|
||||
$propertiesTable
|
||||
$propertiesTable,
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe('207', '', $response);
|
||||
$this->assertXpathValueMatchesPattern(
|
||||
HttpRequestHelper::getResponseXml($response, __METHOD__),
|
||||
$xpath,
|
||||
$pattern,
|
||||
$user
|
||||
$user,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1070,7 +1070,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath($xpath);
|
||||
Assert::assertFalse(
|
||||
isset($xmlPart[0]),
|
||||
"Found item with xpath \"$xpath\" but it should not exist"
|
||||
"Found item with xpath \"$xpath\" but it should not exist",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1091,7 +1091,7 @@ class WebDavPropertiesContext implements Context {
|
||||
string $path,
|
||||
string $property,
|
||||
string $expectedValue,
|
||||
?string $altExpectedValue = null
|
||||
?string $altExpectedValue = null,
|
||||
): void {
|
||||
$this->checkPropertyOfAFolder($user, $path, $property, $expectedValue, $altExpectedValue);
|
||||
}
|
||||
@@ -1128,7 +1128,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$response,
|
||||
$property,
|
||||
$expectedValue,
|
||||
$altExpectedValue
|
||||
$altExpectedValue,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1143,20 +1143,20 @@ class WebDavPropertiesContext implements Context {
|
||||
*/
|
||||
public function theSingleResponseShouldContainAPropertyWithValueLike(
|
||||
string $key,
|
||||
string $regex
|
||||
string $regex,
|
||||
): void {
|
||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
||||
"//d:prop/$key"
|
||||
"//d:prop/$key",
|
||||
);
|
||||
Assert::assertTrue(
|
||||
isset($xmlPart[0]),
|
||||
"Cannot find property \"$key\""
|
||||
"Cannot find property \"$key\"",
|
||||
);
|
||||
$value = $xmlPart[0]->__toString();
|
||||
Assert::assertMatchesRegularExpression(
|
||||
$regex,
|
||||
$value,
|
||||
"Property \"$key\" found with value \"$value\", expected \"$regex\""
|
||||
"Property \"$key\" found with value \"$value\", expected \"$regex\"",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1172,7 +1172,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$this->featureContext->verifyTableNodeColumnsCount($table, 1);
|
||||
WebdavTest::assertResponseContainsShareTypes(
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
||||
$table->getRows()
|
||||
$table->getRows(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1186,16 +1186,16 @@ class WebDavPropertiesContext implements Context {
|
||||
*/
|
||||
public function theResponseShouldContainAnEmptyProperty(string $property): void {
|
||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
||||
"//d:prop/$property"
|
||||
"//d:prop/$property",
|
||||
);
|
||||
Assert::assertCount(
|
||||
1,
|
||||
$xmlPart,
|
||||
"Cannot find property \"$property\""
|
||||
"Cannot find property \"$property\"",
|
||||
);
|
||||
Assert::assertEmpty(
|
||||
$xmlPart[0],
|
||||
"Property \"$property\" is not empty"
|
||||
"Property \"$property\" is not empty",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1212,7 +1212,7 @@ class WebDavPropertiesContext implements Context {
|
||||
string $user,
|
||||
string $path,
|
||||
?string $storePath = "",
|
||||
?string $spaceId = null
|
||||
?string $spaceId = null,
|
||||
): SimpleXMLElement {
|
||||
if ($storePath === "") {
|
||||
$storePath = $path;
|
||||
@@ -1223,7 +1223,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$user,
|
||||
$path,
|
||||
$spaceId,
|
||||
$propertiesTable
|
||||
$propertiesTable,
|
||||
);
|
||||
$xmlObject = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||
$this->storedETAG[$user][$storePath]
|
||||
@@ -1243,7 +1243,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function userStoresEtagOfElement(string $user, string $path): void {
|
||||
$this->storeEtagOfElement(
|
||||
$user,
|
||||
$path
|
||||
$path,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1262,7 +1262,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$this->storeEtagOfElement(
|
||||
$user,
|
||||
$path,
|
||||
$storePath
|
||||
$storePath,
|
||||
);
|
||||
if ($storePath == "") {
|
||||
$storePath = $path;
|
||||
@@ -1285,7 +1285,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$this->storeEtagOfElement(
|
||||
$user,
|
||||
$path
|
||||
$path,
|
||||
);
|
||||
if ($this->storedETAG[$user][$path] === "" || $this->storedETAG[$user][$path] === null) {
|
||||
throw new Exception("Expected stored etag to be some string but found null!");
|
||||
@@ -1302,7 +1302,7 @@ class WebDavPropertiesContext implements Context {
|
||||
Assert::assertTrue(
|
||||
$this->featureContext->isEtagValid($this->featureContext->getEtagFromResponseXmlObject()),
|
||||
__METHOD__
|
||||
. " getetag not found in response"
|
||||
. " getetag not found in response",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1340,7 +1340,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function theResponseShouldHavePropertyWithValue(string $username, TableNode $expectedPropTable): void {
|
||||
$this->featureContext->verifyTableNodeColumns(
|
||||
$expectedPropTable,
|
||||
['resource', 'propertyName', 'propertyValue']
|
||||
['resource', 'propertyName', 'propertyValue'],
|
||||
);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml($this->featureContext->getResponse());
|
||||
|
||||
@@ -1356,7 +1356,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$col["propertyValue"],
|
||||
$xmlPart[0],
|
||||
__METHOD__
|
||||
. " Expected '" . $col["propertyValue"] . "' but got '" . $xmlPart[0] . "'"
|
||||
. " Expected '" . $col["propertyValue"] . "' but got '" . $xmlPart[0] . "'",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1375,10 +1375,10 @@ class WebDavPropertiesContext implements Context {
|
||||
$user,
|
||||
$path,
|
||||
null,
|
||||
$propertiesTable
|
||||
$propertiesTable,
|
||||
);
|
||||
return $this->featureContext->getEtagFromResponseXmlObject(
|
||||
HttpRequestHelper::getResponseXml($response, __METHOD__)
|
||||
HttpRequestHelper::getResponseXml($response, __METHOD__),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1397,14 +1397,14 @@ class WebDavPropertiesContext implements Context {
|
||||
$user,
|
||||
$this->storedETAG,
|
||||
$messageStart
|
||||
. " Trying to check etag of element $path of user $user but the user does not have any stored etags"
|
||||
. " Trying to check etag of element $path of user $user but the user does not have any stored etags",
|
||||
);
|
||||
Assert::assertArrayHasKey(
|
||||
$path,
|
||||
$this->storedETAG[$user],
|
||||
$messageStart
|
||||
. " Trying to check etag of element $path of user "
|
||||
. "$user but the user does not have a stored etag for the element"
|
||||
. "$user but the user does not have a stored etag for the element",
|
||||
);
|
||||
return $this->storedETAG[$user][$path];
|
||||
}
|
||||
@@ -1478,7 +1478,7 @@ class WebDavPropertiesContext implements Context {
|
||||
public function etagOfElementOfUserShouldOrShouldNotHaveChanged(
|
||||
string $path,
|
||||
string $user,
|
||||
string $shouldShouldNot
|
||||
string $shouldShouldNot,
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$actualEtag = $this->getCurrentEtagOfElement($path, $user);
|
||||
@@ -1489,7 +1489,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$actualEtag,
|
||||
__METHOD__
|
||||
. " The etag of element '$path' of user '$user' was not expected to change."
|
||||
. " The stored etag was '$storedEtag' but got '$actualEtag' from the response"
|
||||
. " The stored etag was '$storedEtag' but got '$actualEtag' from the response",
|
||||
);
|
||||
} else {
|
||||
Assert::assertNotEquals(
|
||||
@@ -1497,7 +1497,7 @@ class WebDavPropertiesContext implements Context {
|
||||
$actualEtag,
|
||||
__METHOD__
|
||||
. " The etag of element '$path' of user '$user' was expected to change."
|
||||
. " The stored etag was '$storedEtag' and also got '$actualEtag' from the response"
|
||||
. " The stored etag was '$storedEtag' and also got '$actualEtag' from the response",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user