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,
|
'no_unused_imports' => true,
|
||||||
'array_indentation' => true,
|
'array_indentation' => true,
|
||||||
'method_chaining_indentation' => true,
|
'method_chaining_indentation' => true,
|
||||||
'trailing_comma_in_multiline' => true,
|
'trailing_comma_in_multiline' => [
|
||||||
|
'elements' => ['arrays', 'arguments', 'parameters'],
|
||||||
|
],
|
||||||
'no_useless_else' => true,
|
'no_useless_else' => true,
|
||||||
'single_line_comment_spacing' => true,
|
'single_line_comment_spacing' => true,
|
||||||
'no_trailing_whitespace_in_comment' => true,
|
'no_trailing_whitespace_in_comment' => true,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class WebDav extends Assert {
|
|||||||
?string $element,
|
?string $element,
|
||||||
?string $expectedValue,
|
?string $expectedValue,
|
||||||
?array $responseXmlArray,
|
?array $responseXmlArray,
|
||||||
?string $extraErrorText = ''
|
?string $extraErrorText = '',
|
||||||
): void {
|
): void {
|
||||||
if ($extraErrorText !== '') {
|
if ($extraErrorText !== '') {
|
||||||
$extraErrorText = $extraErrorText . " ";
|
$extraErrorText = $extraErrorText . " ";
|
||||||
@@ -49,7 +49,7 @@ class WebDav extends Assert {
|
|||||||
self::assertArrayHasKey(
|
self::assertArrayHasKey(
|
||||||
'value',
|
'value',
|
||||||
$responseXmlArray,
|
$responseXmlArray,
|
||||||
$extraErrorText . "responseXml does not have key 'value'"
|
$extraErrorText . "responseXml does not have key 'value'",
|
||||||
);
|
);
|
||||||
if ($element === "exception") {
|
if ($element === "exception") {
|
||||||
$result = $responseXmlArray['value'][0]['value'];
|
$result = $responseXmlArray['value'][0]['value'];
|
||||||
@@ -59,14 +59,14 @@ class WebDav extends Assert {
|
|||||||
$result = $responseXmlArray['value'][3]['value'];
|
$result = $responseXmlArray['value'][3]['value'];
|
||||||
} else {
|
} else {
|
||||||
self::fail(
|
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(
|
self::assertEquals(
|
||||||
$expectedValue,
|
$expectedValue,
|
||||||
$result,
|
$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(
|
public static function assertResponseContainsShareTypes(
|
||||||
SimpleXMLElement $responseXmlObject,
|
SimpleXMLElement $responseXmlObject,
|
||||||
?array $expectedShareTypes
|
?array $expectedShareTypes,
|
||||||
): void {
|
): void {
|
||||||
foreach ($expectedShareTypes as $row) {
|
foreach ($expectedShareTypes as $row) {
|
||||||
$xmlPart = $responseXmlObject->xpath(
|
$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(
|
self::assertNotEmpty(
|
||||||
$xmlPart,
|
$xmlPart,
|
||||||
"cannot find share-type '" . $row[0] . "'"
|
"cannot find share-type '" . $row[0] . "'",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class AuthAppHelper {
|
|||||||
public static function listAllAppAuthTokensForUser(
|
public static function listAllAppAuthTokensForUser(
|
||||||
string $baseUrl,
|
string $baseUrl,
|
||||||
string $user,
|
string $user,
|
||||||
string $password
|
string $password,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$url = $baseUrl . self::getAuthAppEndpoint();
|
$url = $baseUrl . self::getAuthAppEndpoint();
|
||||||
return HttpRequestHelper::sendRequest(
|
return HttpRequestHelper::sendRequest(
|
||||||
@@ -92,7 +92,7 @@ class AuthAppHelper {
|
|||||||
string $baseUrl,
|
string $baseUrl,
|
||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
string $token
|
string $token,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$url = $baseUrl . self::getAuthAppEndpoint() . "?token=$token";
|
$url = $baseUrl . self::getAuthAppEndpoint() . "?token=$token";
|
||||||
return HttpRequestHelper::sendRequest(
|
return HttpRequestHelper::sendRequest(
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class BehatHelper {
|
|||||||
public static function getContext(
|
public static function getContext(
|
||||||
ScenarioScope $scope,
|
ScenarioScope $scope,
|
||||||
InitializedContextEnvironment $environment,
|
InitializedContextEnvironment $environment,
|
||||||
string $class
|
string $class,
|
||||||
): Context {
|
): Context {
|
||||||
try {
|
try {
|
||||||
return $environment->getContext($class);
|
return $environment->getContext($class);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class CollaborationHelper {
|
|||||||
$url,
|
$url,
|
||||||
$username,
|
$username,
|
||||||
$password,
|
$password,
|
||||||
['Content-Type' => 'application/json']
|
['Content-Type' => 'application/json'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,14 +78,14 @@ class CollaborationHelper {
|
|||||||
string $password,
|
string $password,
|
||||||
string $parentContainerId,
|
string $parentContainerId,
|
||||||
string $file,
|
string $file,
|
||||||
?array $headers = null
|
?array $headers = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$url = $baseUrl . "/app/new?parent_container_id=$parentContainerId&filename=$file";
|
$url = $baseUrl . "/app/new?parent_container_id=$parentContainerId&filename=$file";
|
||||||
return HttpRequestHelper::post(
|
return HttpRequestHelper::post(
|
||||||
$url,
|
$url,
|
||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class EmailHelper {
|
|||||||
self::getEmailAPIUrl("messages"),
|
self::getEmailAPIUrl("messages"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
['Content-Type' => 'application/json']
|
['Content-Type' => 'application/json'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ class EmailHelper {
|
|||||||
self::getEmailAPIUrl("message/$id") . "?query=$query",
|
self::getEmailAPIUrl("message/$id") . "?query=$query",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
['Content-Type' => 'application/json']
|
['Content-Type' => 'application/json'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ class EmailHelper {
|
|||||||
$url,
|
$url,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
['Content-Type' => 'application/json']
|
['Content-Type' => 'application/json'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ class EmailHelper {
|
|||||||
self::getEmailAPIUrl("messages"),
|
self::getEmailAPIUrl("messages"),
|
||||||
null,
|
null,
|
||||||
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,
|
?CookieJar $cookies = null,
|
||||||
bool $stream = false,
|
bool $stream = false,
|
||||||
?int $timeout = 0,
|
?int $timeout = 0,
|
||||||
?Client $client = null
|
?Client $client = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
if ($client === null) {
|
if ($client === null) {
|
||||||
$client = self::createClient(
|
$client = self::createClient(
|
||||||
@@ -125,7 +125,7 @@ class HttpRequestHelper {
|
|||||||
$config,
|
$config,
|
||||||
$cookies,
|
$cookies,
|
||||||
$stream,
|
$stream,
|
||||||
$timeout
|
$timeout,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ class HttpRequestHelper {
|
|||||||
$url,
|
$url,
|
||||||
$method,
|
$method,
|
||||||
$headers,
|
$headers,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((\getenv('DEBUG_ACCEPTANCE_REQUESTS') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) {
|
if ((\getenv('DEBUG_ACCEPTANCE_REQUESTS') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) {
|
||||||
@@ -216,7 +216,7 @@ class HttpRequestHelper {
|
|||||||
bool $stream = false,
|
bool $stream = false,
|
||||||
?int $timeout = 0,
|
?int $timeout = 0,
|
||||||
?Client $client = null,
|
?Client $client = null,
|
||||||
?bool $isGivenStep = false
|
?bool $isGivenStep = false,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
if ((\getenv('DEBUG_ACCEPTANCE_RESPONSES') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) {
|
if ((\getenv('DEBUG_ACCEPTANCE_RESPONSES') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) {
|
||||||
$debugResponses = true;
|
$debugResponses = true;
|
||||||
@@ -239,7 +239,7 @@ class HttpRequestHelper {
|
|||||||
$cookies,
|
$cookies,
|
||||||
$stream,
|
$stream,
|
||||||
$timeout,
|
$timeout,
|
||||||
$client
|
$client,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($response->getStatusCode() >= 400
|
if ($response->getStatusCode() >= 400
|
||||||
@@ -354,7 +354,7 @@ class HttpRequestHelper {
|
|||||||
*/
|
*/
|
||||||
public static function sendBatchRequest(
|
public static function sendBatchRequest(
|
||||||
?array $requests,
|
?array $requests,
|
||||||
?Client $client
|
?Client $client,
|
||||||
): array {
|
): array {
|
||||||
return Pool::batch($client, $requests);
|
return Pool::batch($client, $requests);
|
||||||
}
|
}
|
||||||
@@ -379,7 +379,7 @@ class HttpRequestHelper {
|
|||||||
?array $config = null,
|
?array $config = null,
|
||||||
?CookieJar $cookies = null,
|
?CookieJar $cookies = null,
|
||||||
?bool $stream = false,
|
?bool $stream = false,
|
||||||
?int $timeout = 0
|
?int $timeout = 0,
|
||||||
): Client {
|
): Client {
|
||||||
$options = [];
|
$options = [];
|
||||||
if ($user !== null) {
|
if ($user !== null) {
|
||||||
@@ -415,7 +415,7 @@ class HttpRequestHelper {
|
|||||||
?string $url,
|
?string $url,
|
||||||
?string $method = 'GET',
|
?string $method = 'GET',
|
||||||
?array $headers = null,
|
?array $headers = null,
|
||||||
$body = null
|
$body = null,
|
||||||
): RequestInterface {
|
): RequestInterface {
|
||||||
if ($headers === null) {
|
if ($headers === null) {
|
||||||
$headers = [];
|
$headers = [];
|
||||||
@@ -434,7 +434,7 @@ class HttpRequestHelper {
|
|||||||
$method,
|
$method,
|
||||||
$url,
|
$url,
|
||||||
$headers,
|
$headers,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
HttpLogger::logRequest($request);
|
HttpLogger::logRequest($request);
|
||||||
return $request;
|
return $request;
|
||||||
@@ -464,7 +464,7 @@ class HttpRequestHelper {
|
|||||||
$body = null,
|
$body = null,
|
||||||
?array $config = null,
|
?array $config = null,
|
||||||
?CookieJar $cookies = null,
|
?CookieJar $cookies = null,
|
||||||
?bool $stream = false
|
?bool $stream = false,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return self::sendRequest(
|
return self::sendRequest(
|
||||||
$url,
|
$url,
|
||||||
@@ -475,7 +475,7 @@ class HttpRequestHelper {
|
|||||||
$body,
|
$body,
|
||||||
$config,
|
$config,
|
||||||
$cookies,
|
$cookies,
|
||||||
$stream
|
$stream,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,7 +503,7 @@ class HttpRequestHelper {
|
|||||||
$body = null,
|
$body = null,
|
||||||
?array $config = null,
|
?array $config = null,
|
||||||
?CookieJar $cookies = null,
|
?CookieJar $cookies = null,
|
||||||
?bool $stream = false
|
?bool $stream = false,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return self::sendRequest(
|
return self::sendRequest(
|
||||||
$url,
|
$url,
|
||||||
@@ -514,7 +514,7 @@ class HttpRequestHelper {
|
|||||||
$body,
|
$body,
|
||||||
$config,
|
$config,
|
||||||
$cookies,
|
$cookies,
|
||||||
$stream
|
$stream,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,7 +542,7 @@ class HttpRequestHelper {
|
|||||||
$body = null,
|
$body = null,
|
||||||
?array $config = null,
|
?array $config = null,
|
||||||
?CookieJar $cookies = null,
|
?CookieJar $cookies = null,
|
||||||
?bool $stream = false
|
?bool $stream = false,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return self::sendRequest(
|
return self::sendRequest(
|
||||||
$url,
|
$url,
|
||||||
@@ -553,7 +553,7 @@ class HttpRequestHelper {
|
|||||||
$body,
|
$body,
|
||||||
$config,
|
$config,
|
||||||
$cookies,
|
$cookies,
|
||||||
$stream
|
$stream,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,7 +582,7 @@ class HttpRequestHelper {
|
|||||||
$body = null,
|
$body = null,
|
||||||
?array $config = null,
|
?array $config = null,
|
||||||
?CookieJar $cookies = null,
|
?CookieJar $cookies = null,
|
||||||
?bool $stream = false
|
?bool $stream = false,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return self::sendRequest(
|
return self::sendRequest(
|
||||||
$url,
|
$url,
|
||||||
@@ -593,7 +593,7 @@ class HttpRequestHelper {
|
|||||||
$body,
|
$body,
|
||||||
$config,
|
$config,
|
||||||
$cookies,
|
$cookies,
|
||||||
$stream
|
$stream,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,15 +619,15 @@ class HttpRequestHelper {
|
|||||||
$responseXmlObject = new SimpleXMLElement($contents);
|
$responseXmlObject = new SimpleXMLElement($contents);
|
||||||
$responseXmlObject->registerXPathNamespace(
|
$responseXmlObject->registerXPathNamespace(
|
||||||
'ocs',
|
'ocs',
|
||||||
'http://open-collaboration-services.org/ns'
|
'http://open-collaboration-services.org/ns',
|
||||||
);
|
);
|
||||||
$responseXmlObject->registerXPathNamespace(
|
$responseXmlObject->registerXPathNamespace(
|
||||||
'oc',
|
'oc',
|
||||||
'http://owncloud.org/ns'
|
'http://owncloud.org/ns',
|
||||||
);
|
);
|
||||||
$responseXmlObject->registerXPathNamespace(
|
$responseXmlObject->registerXPathNamespace(
|
||||||
'd',
|
'd',
|
||||||
'DAV:'
|
'DAV:',
|
||||||
);
|
);
|
||||||
return $responseXmlObject;
|
return $responseXmlObject;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -42,14 +42,14 @@ class OcisConfigHelper {
|
|||||||
public static function sendRequest(
|
public static function sendRequest(
|
||||||
string $url,
|
string $url,
|
||||||
string $method,
|
string $method,
|
||||||
?string $body = ""
|
?string $body = "",
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$client = HttpRequestHelper::createClient();
|
$client = HttpRequestHelper::createClient();
|
||||||
$request = new Request(
|
$request = new Request(
|
||||||
$method,
|
$method,
|
||||||
$url,
|
$url,
|
||||||
[],
|
[],
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -58,7 +58,7 @@ class OcisConfigHelper {
|
|||||||
throw new \Error(
|
throw new \Error(
|
||||||
"Cannot connect to the ociswrapper at the moment,"
|
"Cannot connect to the ociswrapper at the moment,"
|
||||||
. "make sure that ociswrapper is running before proceeding with the test run.\n"
|
. "make sure that ociswrapper is running before proceeding with the test run.\n"
|
||||||
. $e->getMessage()
|
. $e->getMessage(),
|
||||||
);
|
);
|
||||||
} catch (GuzzleException $ex) {
|
} catch (GuzzleException $ex) {
|
||||||
$response = $ex->getResponse();
|
$response = $ex->getResponse();
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class OcisHelper {
|
|||||||
if (!\in_array($storageDriver, self::STORAGE_DRIVERS)) {
|
if (!\in_array($storageDriver, self::STORAGE_DRIVERS)) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"Invalid storage driver. " .
|
"Invalid storage driver. " .
|
||||||
"STORAGE_DRIVER must be '" . \join(", ", self::STORAGE_DRIVERS) . "'"
|
"STORAGE_DRIVER must be '" . \join(", ", self::STORAGE_DRIVERS) . "'",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $storageDriver;
|
return $storageDriver;
|
||||||
@@ -148,7 +148,7 @@ class OcisHelper {
|
|||||||
$deleteCmd = \str_replace(
|
$deleteCmd = \str_replace(
|
||||||
"%s",
|
"%s",
|
||||||
$user[0] . '/' . $user,
|
$user[0] . '/' . $user,
|
||||||
$deleteCmd
|
$deleteCmd,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$deleteCmd = \sprintf($deleteCmd, $user);
|
$deleteCmd = \sprintf($deleteCmd, $user);
|
||||||
@@ -308,7 +308,7 @@ class OcisHelper {
|
|||||||
HttpRequestHelper::get(
|
HttpRequestHelper::get(
|
||||||
$baseUrl . "/ocs/v2.php/apps/notifications/api/v1/notifications",
|
$baseUrl . "/ocs/v2.php/apps/notifications/api/v1/notifications",
|
||||||
$user,
|
$user,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class OcmHelper {
|
|||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
?string $email = null,
|
?string $email = null,
|
||||||
?string $description = null
|
?string $description = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$body = [
|
$body = [
|
||||||
"description" => $description,
|
"description" => $description,
|
||||||
@@ -80,7 +80,7 @@ class OcmHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
self::getRequestHeaders(),
|
self::getRequestHeaders(),
|
||||||
\json_encode($body)
|
\json_encode($body),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ class OcmHelper {
|
|||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
string $token,
|
string $token,
|
||||||
string $providerDomain
|
string $providerDomain,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$body = [
|
$body = [
|
||||||
"token" => $token,
|
"token" => $token,
|
||||||
@@ -111,7 +111,7 @@ class OcmHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
self::getRequestHeaders(),
|
self::getRequestHeaders(),
|
||||||
\json_encode($body)
|
\json_encode($body),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,14 +126,14 @@ class OcmHelper {
|
|||||||
public static function findAcceptedUsers(
|
public static function findAcceptedUsers(
|
||||||
string $baseUrl,
|
string $baseUrl,
|
||||||
string $user,
|
string $user,
|
||||||
string $password
|
string $password,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$url = self::getFullUrl($baseUrl, 'find-accepted-users');
|
$url = self::getFullUrl($baseUrl, 'find-accepted-users');
|
||||||
return HttpRequestHelper::get(
|
return HttpRequestHelper::get(
|
||||||
$url,
|
$url,
|
||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
self::getRequestHeaders()
|
self::getRequestHeaders(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,14 +148,14 @@ class OcmHelper {
|
|||||||
public static function listInvite(
|
public static function listInvite(
|
||||||
string $baseUrl,
|
string $baseUrl,
|
||||||
string $user,
|
string $user,
|
||||||
string $password
|
string $password,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$url = self::getFullUrl($baseUrl, 'list-invite');
|
$url = self::getFullUrl($baseUrl, 'list-invite');
|
||||||
return HttpRequestHelper::get(
|
return HttpRequestHelper::get(
|
||||||
$url,
|
$url,
|
||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
self::getRequestHeaders()
|
self::getRequestHeaders(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ class OcmHelper {
|
|||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
string $userId,
|
string $userId,
|
||||||
string $idp
|
string $idp,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$url = self::getFullUrl($baseUrl, 'delete-accepted-user');
|
$url = self::getFullUrl($baseUrl, 'delete-accepted-user');
|
||||||
$body = [
|
$body = [
|
||||||
@@ -186,7 +186,7 @@ class OcmHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
self::getRequestHeaders(),
|
self::getRequestHeaders(),
|
||||||
\json_encode($body)
|
\json_encode($body),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class OcsApiHelper {
|
|||||||
?string $path,
|
?string $path,
|
||||||
$body = [],
|
$body = [],
|
||||||
?int $ocsApiVersion = 2,
|
?int $ocsApiVersion = 2,
|
||||||
?array $headers = []
|
?array $headers = [],
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$fullUrl = $baseUrl;
|
$fullUrl = $baseUrl;
|
||||||
if (\substr($fullUrl, -1) !== '/') {
|
if (\substr($fullUrl, -1) !== '/') {
|
||||||
@@ -81,7 +81,7 @@ class OcsApiHelper {
|
|||||||
?string $path,
|
?string $path,
|
||||||
$body = [],
|
$body = [],
|
||||||
?int $ocsApiVersion = 2,
|
?int $ocsApiVersion = 2,
|
||||||
?array $headers = []
|
?array $headers = [],
|
||||||
): RequestInterface {
|
): RequestInterface {
|
||||||
$fullUrl = $baseUrl;
|
$fullUrl = $baseUrl;
|
||||||
if (\substr($fullUrl, -1) !== '/') {
|
if (\substr($fullUrl, -1) !== '/') {
|
||||||
@@ -92,7 +92,7 @@ class OcsApiHelper {
|
|||||||
$fullUrl,
|
$fullUrl,
|
||||||
$method,
|
$method,
|
||||||
$headers,
|
$headers,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class SettingsHelper {
|
|||||||
string $baseUrl,
|
string $baseUrl,
|
||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
array $headers = []
|
array $headers = [],
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$fullUrl = self::buildFullUrl($baseUrl, "bundles-list");
|
$fullUrl = self::buildFullUrl($baseUrl, "bundles-list");
|
||||||
return HttpRequestHelper::post(
|
return HttpRequestHelper::post(
|
||||||
@@ -102,7 +102,7 @@ class SettingsHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$headers,
|
$headers,
|
||||||
"{}"
|
"{}",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ class SettingsHelper {
|
|||||||
string $baseUrl,
|
string $baseUrl,
|
||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
array $headers = []
|
array $headers = [],
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$fullUrl = self::buildFullUrl($baseUrl, "roles-list");
|
$fullUrl = self::buildFullUrl($baseUrl, "roles-list");
|
||||||
return HttpRequestHelper::post(
|
return HttpRequestHelper::post(
|
||||||
@@ -158,7 +158,7 @@ class SettingsHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$headers,
|
$headers,
|
||||||
"{}"
|
"{}",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ class SettingsHelper {
|
|||||||
string $password,
|
string $password,
|
||||||
string $assigneeId,
|
string $assigneeId,
|
||||||
string $roleId,
|
string $roleId,
|
||||||
array $headers = []
|
array $headers = [],
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$fullUrl = self::buildFullUrl($baseUrl, "assignments-add");
|
$fullUrl = self::buildFullUrl($baseUrl, "assignments-add");
|
||||||
$body = json_encode(["account_uuid" => $assigneeId, "role_id" => $roleId], JSON_THROW_ON_ERROR);
|
$body = json_encode(["account_uuid" => $assigneeId, "role_id" => $roleId], JSON_THROW_ON_ERROR);
|
||||||
@@ -190,7 +190,7 @@ class SettingsHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$headers,
|
$headers,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ class SettingsHelper {
|
|||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
string $userId,
|
string $userId,
|
||||||
array $headers = []
|
array $headers = [],
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$fullUrl = self::buildFullUrl($baseUrl, "assignments-list");
|
$fullUrl = self::buildFullUrl($baseUrl, "assignments-list");
|
||||||
$body = json_encode(["account_uuid" => $userId], JSON_THROW_ON_ERROR);
|
$body = json_encode(["account_uuid" => $userId], JSON_THROW_ON_ERROR);
|
||||||
@@ -220,7 +220,7 @@ class SettingsHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$headers,
|
$headers,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ class SettingsHelper {
|
|||||||
string $baseUrl,
|
string $baseUrl,
|
||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
array $headers = []
|
array $headers = [],
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$fullUrl = self::buildFullUrl($baseUrl, "values-list");
|
$fullUrl = self::buildFullUrl($baseUrl, "values-list");
|
||||||
$body = json_encode(["account_uuid" => "me"], JSON_THROW_ON_ERROR);
|
$body = json_encode(["account_uuid" => "me"], JSON_THROW_ON_ERROR);
|
||||||
@@ -248,7 +248,7 @@ class SettingsHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$headers,
|
$headers,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ class SettingsHelper {
|
|||||||
string $user,
|
string $user,
|
||||||
string $password,
|
string $password,
|
||||||
string $body,
|
string $body,
|
||||||
array $headers = []
|
array $headers = [],
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$fullUrl = self::buildFullUrl($baseUrl, "values-save");
|
$fullUrl = self::buildFullUrl($baseUrl, "values-save");
|
||||||
return HttpRequestHelper::post(
|
return HttpRequestHelper::post(
|
||||||
@@ -346,7 +346,7 @@ class SettingsHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$headers,
|
$headers,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,14 +373,14 @@ class SettingsHelper {
|
|||||||
"accountUuid" => "me",
|
"accountUuid" => "me",
|
||||||
"settingId" => $settingId,
|
"settingId" => $settingId,
|
||||||
],
|
],
|
||||||
JSON_THROW_ON_ERROR
|
JSON_THROW_ON_ERROR,
|
||||||
);
|
);
|
||||||
return HttpRequestHelper::post(
|
return HttpRequestHelper::post(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
[],
|
[],
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
public static function init(
|
public static function init(
|
||||||
?string $adminUsername,
|
?string $adminUsername,
|
||||||
?string $adminPassword,
|
?string $adminPassword,
|
||||||
?string $baseUrl
|
?string $baseUrl,
|
||||||
): void {
|
): void {
|
||||||
foreach (\func_get_args() as $variableToCheck) {
|
foreach (\func_get_args() as $variableToCheck) {
|
||||||
if (!\is_string($variableToCheck)) {
|
if (!\is_string($variableToCheck)) {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
"mandatory argument missing or wrong type ($variableToCheck => "
|
"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) {
|
if ($result->getStatusCode() !== 200) {
|
||||||
throw new \Exception(
|
throw new \Exception(
|
||||||
"could not get sysinfo " . $result->getReasonPhrase()
|
"could not get sysinfo " . $result->getReasonPhrase(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return HttpRequestHelper::getResponseXml($result, __METHOD__)->data;
|
return HttpRequestHelper::getResponseXml($result, __METHOD__)->data;
|
||||||
@@ -140,7 +140,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
&& $adminUsername === null
|
&& $adminUsername === null
|
||||||
) {
|
) {
|
||||||
throw new Exception(
|
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) {
|
if ($adminUsername === null) {
|
||||||
@@ -161,7 +161,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
&& $adminPassword === null
|
&& $adminPassword === null
|
||||||
) {
|
) {
|
||||||
throw new Exception(
|
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) {
|
if ($adminPassword === null) {
|
||||||
@@ -182,7 +182,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
&& $baseUrl === null
|
&& $baseUrl === null
|
||||||
) {
|
) {
|
||||||
throw new Exception(
|
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) {
|
if ($baseUrl === null) {
|
||||||
@@ -206,7 +206,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
?string $dirPathFromServerRoot,
|
?string $dirPathFromServerRoot,
|
||||||
?string $baseUrl = null,
|
?string $baseUrl = null,
|
||||||
?string $adminUsername = null,
|
?string $adminUsername = null,
|
||||||
?string $adminPassword = null
|
?string $adminPassword = null,
|
||||||
): void {
|
): void {
|
||||||
$baseUrl = self::checkBaseUrl($baseUrl, "mkDirOnServer");
|
$baseUrl = self::checkBaseUrl($baseUrl, "mkDirOnServer");
|
||||||
$adminUsername = self::checkAdminUsername($adminUsername, "mkDirOnServer");
|
$adminUsername = self::checkAdminUsername($adminUsername, "mkDirOnServer");
|
||||||
@@ -217,12 +217,12 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
$adminPassword,
|
$adminPassword,
|
||||||
"POST",
|
"POST",
|
||||||
"/apps/testing/api/v1/dir",
|
"/apps/testing/api/v1/dir",
|
||||||
['dir' => $dirPathFromServerRoot]
|
['dir' => $dirPathFromServerRoot],
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result->getStatusCode() !== 200) {
|
if ($result->getStatusCode() !== 200) {
|
||||||
throw new \Exception(
|
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 $dirPathFromServerRoot,
|
||||||
?string $baseUrl = null,
|
?string $baseUrl = null,
|
||||||
?string $adminUsername = null,
|
?string $adminUsername = null,
|
||||||
?string $adminPassword = null
|
?string $adminPassword = null,
|
||||||
): void {
|
): void {
|
||||||
$baseUrl = self::checkBaseUrl($baseUrl, "rmDirOnServer");
|
$baseUrl = self::checkBaseUrl($baseUrl, "rmDirOnServer");
|
||||||
$adminUsername = self::checkAdminUsername($adminUsername, "rmDirOnServer");
|
$adminUsername = self::checkAdminUsername($adminUsername, "rmDirOnServer");
|
||||||
@@ -253,12 +253,12 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
$adminPassword,
|
$adminPassword,
|
||||||
"DELETE",
|
"DELETE",
|
||||||
"/apps/testing/api/v1/dir",
|
"/apps/testing/api/v1/dir",
|
||||||
['dir' => $dirPathFromServerRoot]
|
['dir' => $dirPathFromServerRoot],
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result->getStatusCode() !== 200) {
|
if ($result->getStatusCode() !== 200) {
|
||||||
throw new \Exception(
|
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 $content,
|
||||||
?string $baseUrl = null,
|
?string $baseUrl = null,
|
||||||
?string $adminUsername = null,
|
?string $adminUsername = null,
|
||||||
?string $adminPassword = null
|
?string $adminPassword = null,
|
||||||
): void {
|
): void {
|
||||||
$baseUrl = self::checkBaseUrl($baseUrl, "createFileOnServer");
|
$baseUrl = self::checkBaseUrl($baseUrl, "createFileOnServer");
|
||||||
$adminUsername = self::checkAdminUsername($adminUsername, "createFileOnServer");
|
$adminUsername = self::checkAdminUsername($adminUsername, "createFileOnServer");
|
||||||
@@ -294,12 +294,12 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
[
|
[
|
||||||
'file' => $filePathFromServerRoot,
|
'file' => $filePathFromServerRoot,
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result->getStatusCode() !== 200) {
|
if ($result->getStatusCode() !== 200) {
|
||||||
throw new \Exception(
|
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 $filePathFromServerRoot,
|
||||||
?string $baseUrl = null,
|
?string $baseUrl = null,
|
||||||
?string $adminUsername = null,
|
?string $adminUsername = null,
|
||||||
?string $adminPassword = null
|
?string $adminPassword = null,
|
||||||
): void {
|
): void {
|
||||||
$baseUrl = self::checkBaseUrl($baseUrl, "deleteFileOnServer");
|
$baseUrl = self::checkBaseUrl($baseUrl, "deleteFileOnServer");
|
||||||
$adminUsername = self::checkAdminUsername($adminUsername, "deleteFileOnServer");
|
$adminUsername = self::checkAdminUsername($adminUsername, "deleteFileOnServer");
|
||||||
@@ -332,12 +332,12 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
"/apps/testing/api/v1/file",
|
"/apps/testing/api/v1/file",
|
||||||
[
|
[
|
||||||
'file' => $filePathFromServerRoot,
|
'file' => $filePathFromServerRoot,
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result->getStatusCode() !== 200) {
|
if ($result->getStatusCode() !== 200) {
|
||||||
throw new \Exception(
|
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 $fileInCore,
|
||||||
?string $baseUrl = null,
|
?string $baseUrl = null,
|
||||||
?string $adminUsername = null,
|
?string $adminUsername = null,
|
||||||
?string $adminPassword = null
|
?string $adminPassword = null,
|
||||||
): string {
|
): string {
|
||||||
$baseUrl = self::checkBaseUrl($baseUrl, "readFile");
|
$baseUrl = self::checkBaseUrl($baseUrl, "readFile");
|
||||||
$adminUsername = self::checkAdminUsername(
|
$adminUsername = self::checkAdminUsername(
|
||||||
$adminUsername,
|
$adminUsername,
|
||||||
"readFile"
|
"readFile",
|
||||||
);
|
);
|
||||||
$adminPassword = self::checkAdminPassword(
|
$adminPassword = self::checkAdminPassword(
|
||||||
$adminPassword,
|
$adminPassword,
|
||||||
"readFile"
|
"readFile",
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = OcsApiHelper::sendRequest(
|
$response = OcsApiHelper::sendRequest(
|
||||||
@@ -378,7 +378,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert {
|
|||||||
self::assertSame(
|
self::assertSame(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$response->getStatusCode(),
|
||||||
"Failed to read the file $fileInCore"
|
"Failed to read the file $fileInCore",
|
||||||
);
|
);
|
||||||
$localContent = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
$localContent = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||||
$localContent = (string)$localContent->data->element->contentUrlEncoded;
|
$localContent = (string)$localContent->data->element->contentUrlEncoded;
|
||||||
|
|||||||
@@ -106,14 +106,14 @@ class SharingHelper {
|
|||||||
?string $space_ref = null,
|
?string $space_ref = null,
|
||||||
int $ocsApiVersion = 1,
|
int $ocsApiVersion = 1,
|
||||||
int $sharingApiVersion = 1,
|
int $sharingApiVersion = 1,
|
||||||
string $sharingApp = 'files_sharing'
|
string $sharingApp = 'files_sharing',
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$fd = [];
|
$fd = [];
|
||||||
foreach ([$path, $baseUrl, $user, $password] as $variableToCheck) {
|
foreach ([$path, $baseUrl, $user, $password] as $variableToCheck) {
|
||||||
if (!\is_string($variableToCheck)) {
|
if (!\is_string($variableToCheck)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
"mandatory argument missing or wrong type ($variableToCheck => "
|
"mandatory argument missing or wrong type ($variableToCheck => "
|
||||||
. \gettype($variableToCheck) . ")"
|
. \gettype($variableToCheck) . ")",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,12 +127,12 @@ class SharingHelper {
|
|||||||
|
|
||||||
if (!\in_array($ocsApiVersion, [1, 2], true)) {
|
if (!\in_array($ocsApiVersion, [1, 2], true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
"invalid ocsApiVersion ($ocsApiVersion)"
|
"invalid ocsApiVersion ($ocsApiVersion)",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!\in_array($sharingApiVersion, [1, 2], true)) {
|
if (!\in_array($sharingApiVersion, [1, 2], true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
"invalid sharingApiVersion ($sharingApiVersion)"
|
"invalid sharingApiVersion ($sharingApiVersion)",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ class SharingHelper {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$headers,
|
$headers,
|
||||||
$fd
|
$fd,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,13 +206,13 @@ class SharingHelper {
|
|||||||
$permissionSum += $permission;
|
$permissionSum += $permission;
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
"invalid permission type ($permission)"
|
"invalid permission type ($permission)",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($permissionSum < 0 || $permissionSum > 31) {
|
if ($permissionSum < 0 || $permissionSum > 31) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
"invalid permission total ($permissionSum)"
|
"invalid permission total ($permissionSum)",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $permissionSum;
|
return $permissionSum;
|
||||||
@@ -239,7 +239,7 @@ class SharingHelper {
|
|||||||
return self::SHARE_TYPES[$key];
|
return self::SHARE_TYPES[$key];
|
||||||
}
|
}
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
"invalid share type ($shareType)"
|
"invalid share type ($shareType)",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ class SharingHelper {
|
|||||||
*/
|
*/
|
||||||
public static function getLastShareIdFromResponse(
|
public static function getLastShareIdFromResponse(
|
||||||
SimpleXMLElement $responseXmlObject,
|
SimpleXMLElement $responseXmlObject,
|
||||||
string $errorMessage = "cannot find share id in response"
|
string $errorMessage = "cannot find share id in response",
|
||||||
): string {
|
): string {
|
||||||
$xmlPart = $responseXmlObject->xpath("//data/element[last()]/id");
|
$xmlPart = $responseXmlObject->xpath("//data/element[last()]/id");
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class TusClient extends Client {
|
|||||||
[
|
[
|
||||||
'body' => $data,
|
'body' => $data,
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
$response = $e->getResponse();
|
$response = $e->getResponse();
|
||||||
@@ -84,9 +84,9 @@ class TusClient extends Client {
|
|||||||
[
|
[
|
||||||
'location' => $uploadLocation,
|
'location' => $uploadLocation,
|
||||||
'expires_at' => Carbon::now()->addSeconds(
|
'expires_at' => Carbon::now()->addSeconds(
|
||||||
$this->getCache()->getTtl()
|
$this->getCache()->getTtl(),
|
||||||
)->format($this->getCache()::RFC_7231),
|
)->format($this->getCache()::RFC_7231),
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $response;
|
return $response;
|
||||||
@@ -130,7 +130,7 @@ class TusClient extends Client {
|
|||||||
[
|
[
|
||||||
'body' => $data,
|
'body' => $data,
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class UploadHelper extends Assert {
|
|||||||
null,
|
null,
|
||||||
[],
|
[],
|
||||||
null,
|
null,
|
||||||
$isGivenStep
|
$isGivenStep,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ class UploadHelper extends Assert {
|
|||||||
null,
|
null,
|
||||||
[],
|
[],
|
||||||
null,
|
null,
|
||||||
$isGivenStep
|
$isGivenStep,
|
||||||
);
|
);
|
||||||
if ($result->getStatusCode() >= 400) {
|
if ($result->getStatusCode() >= 400) {
|
||||||
return $result;
|
return $result;
|
||||||
@@ -173,7 +173,7 @@ class UploadHelper extends Assert {
|
|||||||
return $size;
|
return $size;
|
||||||
default:
|
default:
|
||||||
throw new \InvalidArgumentException(
|
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);
|
\fclose($file);
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
1,
|
1,
|
||||||
\file_exists($name)
|
\file_exists($name),
|
||||||
);
|
);
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
$size,
|
$size,
|
||||||
\filesize($name)
|
\filesize($name),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ class UploadHelper extends Assert {
|
|||||||
\fclose($file);
|
\fclose($file);
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
1,
|
1,
|
||||||
\file_exists($name)
|
\file_exists($name),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class UserHelper {
|
|||||||
string $value,
|
string $value,
|
||||||
string $adminUser,
|
string $adminUser,
|
||||||
string $adminPassword,
|
string $adminPassword,
|
||||||
?int $ocsApiVersion = 2
|
?int $ocsApiVersion = 2,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return OcsApiHelper::sendRequest(
|
return OcsApiHelper::sendRequest(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
@@ -62,7 +62,7 @@ class UserHelper {
|
|||||||
"PUT",
|
"PUT",
|
||||||
"/cloud/users/" . $user,
|
"/cloud/users/" . $user,
|
||||||
["key" => $key, "value" => $value],
|
["key" => $key, "value" => $value],
|
||||||
$ocsApiVersion
|
$ocsApiVersion,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,12 +84,12 @@ class UserHelper {
|
|||||||
?array $editData,
|
?array $editData,
|
||||||
?string $adminUser,
|
?string $adminUser,
|
||||||
?string $adminPassword,
|
?string $adminPassword,
|
||||||
?int $ocsApiVersion = 2
|
?int $ocsApiVersion = 2,
|
||||||
): array {
|
): array {
|
||||||
$requests = [];
|
$requests = [];
|
||||||
$client = HttpRequestHelper::createClient(
|
$client = HttpRequestHelper::createClient(
|
||||||
$adminUser,
|
$adminUser,
|
||||||
$adminPassword
|
$adminPassword,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($editData as $data) {
|
foreach ($editData as $data) {
|
||||||
@@ -100,7 +100,7 @@ class UserHelper {
|
|||||||
$baseUrl,
|
$baseUrl,
|
||||||
'PUT',
|
'PUT',
|
||||||
$path,
|
$path,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Send the array of requests at once in parallel.
|
// Send the array of requests at once in parallel.
|
||||||
@@ -111,7 +111,7 @@ class UserHelper {
|
|||||||
$httpStatusCode = $e->getResponse()->getStatusCode();
|
$httpStatusCode = $e->getResponse()->getStatusCode();
|
||||||
$reasonPhrase = $e->getResponse()->getReasonPhrase();
|
$reasonPhrase = $e->getResponse()->getReasonPhrase();
|
||||||
throw new Exception(
|
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 $userName,
|
||||||
?string $adminUser,
|
?string $adminUser,
|
||||||
?string $adminPassword,
|
?string $adminPassword,
|
||||||
?int $ocsApiVersion = 2
|
?int $ocsApiVersion = 2,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return OcsApiHelper::sendRequest(
|
return OcsApiHelper::sendRequest(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
@@ -143,7 +143,7 @@ class UserHelper {
|
|||||||
"GET",
|
"GET",
|
||||||
"/cloud/users/" . $userName,
|
"/cloud/users/" . $userName,
|
||||||
[],
|
[],
|
||||||
$ocsApiVersion
|
$ocsApiVersion,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ class UserHelper {
|
|||||||
?string $userName,
|
?string $userName,
|
||||||
?string $adminUser,
|
?string $adminUser,
|
||||||
?string $adminPassword,
|
?string $adminPassword,
|
||||||
?int $ocsApiVersion = 2
|
?int $ocsApiVersion = 2,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return OcsApiHelper::sendRequest(
|
return OcsApiHelper::sendRequest(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
@@ -172,7 +172,7 @@ class UserHelper {
|
|||||||
"DELETE",
|
"DELETE",
|
||||||
"/cloud/users/" . $userName,
|
"/cloud/users/" . $userName,
|
||||||
[],
|
[],
|
||||||
$ocsApiVersion
|
$ocsApiVersion,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ class UserHelper {
|
|||||||
?string $group,
|
?string $group,
|
||||||
?string $adminUser,
|
?string $adminUser,
|
||||||
?string $adminPassword,
|
?string $adminPassword,
|
||||||
?int $ocsApiVersion = 2
|
?int $ocsApiVersion = 2,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return OcsApiHelper::sendRequest(
|
return OcsApiHelper::sendRequest(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
@@ -203,7 +203,7 @@ class UserHelper {
|
|||||||
"POST",
|
"POST",
|
||||||
"/cloud/users/" . $user . "/groups",
|
"/cloud/users/" . $user . "/groups",
|
||||||
['groupid' => $group],
|
['groupid' => $group],
|
||||||
$ocsApiVersion
|
$ocsApiVersion,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ class UserHelper {
|
|||||||
?string $group,
|
?string $group,
|
||||||
?string $adminUser,
|
?string $adminUser,
|
||||||
?string $adminPassword,
|
?string $adminPassword,
|
||||||
?int $ocsApiVersion = 2
|
?int $ocsApiVersion = 2,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return OcsApiHelper::sendRequest(
|
return OcsApiHelper::sendRequest(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
@@ -234,7 +234,7 @@ class UserHelper {
|
|||||||
"DELETE",
|
"DELETE",
|
||||||
"/cloud/users/" . $user . "/groups",
|
"/cloud/users/" . $user . "/groups",
|
||||||
['groupid' => $group],
|
['groupid' => $group],
|
||||||
$ocsApiVersion
|
$ocsApiVersion,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ class UserHelper {
|
|||||||
?string $baseUrl,
|
?string $baseUrl,
|
||||||
?string $adminUser,
|
?string $adminUser,
|
||||||
?string $adminPassword,
|
?string $adminPassword,
|
||||||
?string $search = ""
|
?string $search = "",
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return OcsApiHelper::sendRequest(
|
return OcsApiHelper::sendRequest(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
@@ -277,13 +277,13 @@ class UserHelper {
|
|||||||
?string $baseUrl,
|
?string $baseUrl,
|
||||||
?string $adminUser,
|
?string $adminUser,
|
||||||
?string $adminPassword,
|
?string $adminPassword,
|
||||||
?string $search = ""
|
?string $search = "",
|
||||||
): array {
|
): array {
|
||||||
$result = self::getGroups(
|
$result = self::getGroups(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
$adminUser,
|
$adminUser,
|
||||||
$adminPassword,
|
$adminPassword,
|
||||||
$search
|
$search,
|
||||||
);
|
);
|
||||||
$groups = HttpRequestHelper::getResponseXml($result, __METHOD__)->xpath(".//groups")[0];
|
$groups = HttpRequestHelper::getResponseXml($result, __METHOD__)->xpath(".//groups")[0];
|
||||||
$return = [];
|
$return = [];
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class WebDavHelper {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function removeSpaceIdReferenceForUser(
|
public static function removeSpaceIdReferenceForUser(
|
||||||
?string $user
|
?string $user,
|
||||||
): void {
|
): void {
|
||||||
if (\array_key_exists($user, self::$spacesIdRef)) {
|
if (\array_key_exists($user, self::$spacesIdRef)) {
|
||||||
unset(self::$spacesIdRef[$user]);
|
unset(self::$spacesIdRef[$user]);
|
||||||
@@ -123,7 +123,7 @@ class WebDavHelper {
|
|||||||
?string $password,
|
?string $password,
|
||||||
?string $path,
|
?string $path,
|
||||||
?string $spaceId = null,
|
?string $spaceId = null,
|
||||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW
|
?int $davPathVersionToUse = self::DAV_VERSION_NEW,
|
||||||
): string {
|
): string {
|
||||||
$body
|
$body
|
||||||
= '<?xml version="1.0"?>
|
= '<?xml version="1.0"?>
|
||||||
@@ -141,12 +141,12 @@ class WebDavHelper {
|
|||||||
null,
|
null,
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$body,
|
$body,
|
||||||
$davPathVersionToUse
|
$davPathVersionToUse,
|
||||||
);
|
);
|
||||||
\preg_match(
|
\preg_match(
|
||||||
'/\<oc:fileid\>([^\<]*)\<\/oc:fileid\>/',
|
'/\<oc:fileid\>([^\<]*)\<\/oc:fileid\>/',
|
||||||
$response->getBody()->getContents(),
|
$response->getBody()->getContents(),
|
||||||
$matches
|
$matches,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isset($matches[1])) {
|
if (!isset($matches[1])) {
|
||||||
@@ -239,7 +239,7 @@ class WebDavHelper {
|
|||||||
?string $type = "files",
|
?string $type = "files",
|
||||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW,
|
?int $davPathVersionToUse = self::DAV_VERSION_NEW,
|
||||||
?string $doDavRequestAsUser = null,
|
?string $doDavRequestAsUser = null,
|
||||||
?array $headers = []
|
?array $headers = [],
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$body = self::getBodyForPropfind($properties);
|
$body = self::getBodyForPropfind($properties);
|
||||||
$folderDepth = (string) $folderDepth;
|
$folderDepth = (string) $folderDepth;
|
||||||
@@ -267,7 +267,7 @@ class WebDavHelper {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
[],
|
[],
|
||||||
$doDavRequestAsUser
|
$doDavRequestAsUser,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ class WebDavHelper {
|
|||||||
$spaceId,
|
$spaceId,
|
||||||
$body,
|
$body,
|
||||||
$davPathVersionToUse,
|
$davPathVersionToUse,
|
||||||
$type
|
$type,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ class WebDavHelper {
|
|||||||
?array $propertiesArray,
|
?array $propertiesArray,
|
||||||
?int $davPathVersion = null,
|
?int $davPathVersion = null,
|
||||||
?string $namespaceString = null,
|
?string $namespaceString = null,
|
||||||
?string $type = "files"
|
?string $type = "files",
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$propertyBody = "";
|
$propertyBody = "";
|
||||||
foreach ($propertiesArray as $propertyArray) {
|
foreach ($propertiesArray as $propertyArray) {
|
||||||
@@ -395,7 +395,7 @@ class WebDavHelper {
|
|||||||
$matches = [];
|
$matches = [];
|
||||||
[$namespacePrefix, $namespace, $property] = self::getPropertyWithNamespaceInfo(
|
[$namespacePrefix, $namespace, $property] = self::getPropertyWithNamespaceInfo(
|
||||||
$namespaceString,
|
$namespaceString,
|
||||||
$property
|
$property,
|
||||||
);
|
);
|
||||||
$propertyBody .= "\n\t<$namespacePrefix:$property>" .
|
$propertyBody .= "\n\t<$namespacePrefix:$property>" .
|
||||||
"$value" .
|
"$value" .
|
||||||
@@ -422,7 +422,7 @@ class WebDavHelper {
|
|||||||
null,
|
null,
|
||||||
$body,
|
$body,
|
||||||
$davPathVersion,
|
$davPathVersion,
|
||||||
$type
|
$type,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +451,7 @@ class WebDavHelper {
|
|||||||
?string $spaceId = null,
|
?string $spaceId = null,
|
||||||
?array $properties = null,
|
?array $properties = null,
|
||||||
?string $type = "files",
|
?string $type = "files",
|
||||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW
|
?int $davPathVersionToUse = self::DAV_VERSION_NEW,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
if (!$properties) {
|
if (!$properties) {
|
||||||
$properties = [
|
$properties = [
|
||||||
@@ -467,7 +467,7 @@ class WebDavHelper {
|
|||||||
$folderDepth,
|
$folderDepth,
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$type,
|
$type,
|
||||||
$davPathVersionToUse
|
$davPathVersionToUse,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,22 +531,22 @@ class WebDavHelper {
|
|||||||
$fullUrl,
|
$fullUrl,
|
||||||
'PROPFIND',
|
'PROPFIND',
|
||||||
$user,
|
$user,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
207,
|
207,
|
||||||
$response->getStatusCode(),
|
$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(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$response,
|
$response,
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$xmlPart = $responseXmlObject->xpath("/d:multistatus/d:response[1]/d:propstat/d:prop/oc:spaceid");
|
$xmlPart = $responseXmlObject->xpath("/d:multistatus/d:response[1]/d:propstat/d:prop/oc:spaceid");
|
||||||
Assert::assertNotEmpty(
|
Assert::assertNotEmpty(
|
||||||
$xmlPart,
|
$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();
|
$personalSpaceId = $xmlPart[0]->__toString();
|
||||||
@@ -582,7 +582,7 @@ class WebDavHelper {
|
|||||||
return self::getPersonalSpaceIdForUser(
|
return self::getPersonalSpaceIdForUser(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
$user,
|
$user,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -715,7 +715,7 @@ class WebDavHelper {
|
|||||||
$headers[$key] = \str_replace(
|
$headers[$key] = \str_replace(
|
||||||
$urlSpecialChar[0],
|
$urlSpecialChar[0],
|
||||||
$urlSpecialChar[1],
|
$urlSpecialChar[1],
|
||||||
$value
|
$value,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -734,7 +734,7 @@ class WebDavHelper {
|
|||||||
$stream,
|
$stream,
|
||||||
$timeout,
|
$timeout,
|
||||||
$client,
|
$client,
|
||||||
$isGivenStep
|
$isGivenStep,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -750,7 +750,7 @@ class WebDavHelper {
|
|||||||
public static function getDavPath(
|
public static function getDavPath(
|
||||||
int $davPathVersion,
|
int $davPathVersion,
|
||||||
?string $userOrItemIdOrSpaceIdOrToken = null,
|
?string $userOrItemIdOrSpaceIdOrToken = null,
|
||||||
?string $type = "files"
|
?string $type = "files",
|
||||||
): string {
|
): string {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'archive':
|
case 'archive':
|
||||||
@@ -830,7 +830,7 @@ class WebDavHelper {
|
|||||||
?string $baseUrl,
|
?string $baseUrl,
|
||||||
?string $fileName,
|
?string $fileName,
|
||||||
?string $token,
|
?string $token,
|
||||||
?int $davVersionToUse = self::DAV_VERSION_NEW
|
?int $davVersionToUse = self::DAV_VERSION_NEW,
|
||||||
): string {
|
): string {
|
||||||
$response = self::propfind(
|
$response = self::propfind(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
@@ -841,11 +841,11 @@ class WebDavHelper {
|
|||||||
'1',
|
'1',
|
||||||
null,
|
null,
|
||||||
"public-files",
|
"public-files",
|
||||||
$davVersionToUse
|
$davVersionToUse,
|
||||||
);
|
);
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$response,
|
$response,
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$xmlPart = $responseXmlObject->xpath("//d:getlastmodified");
|
$xmlPart = $responseXmlObject->xpath("//d:getlastmodified");
|
||||||
|
|
||||||
@@ -883,11 +883,11 @@ class WebDavHelper {
|
|||||||
"0",
|
"0",
|
||||||
$spaceId,
|
$spaceId,
|
||||||
"files",
|
"files",
|
||||||
$davPathVersionToUse
|
$davPathVersionToUse,
|
||||||
);
|
);
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$response,
|
$response,
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$xmlPart = $responseXmlObject->xpath("//d:getlastmodified");
|
$xmlPart = $responseXmlObject->xpath("//d:getlastmodified");
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
@@ -895,7 +895,7 @@ class WebDavHelper {
|
|||||||
$xmlPart,
|
$xmlPart,
|
||||||
__METHOD__
|
__METHOD__
|
||||||
. " XML part does not have key 0. Expected a value at index 0 of 'xmlPart' but, found: "
|
. " 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());
|
$mtime = new DateTime($xmlPart[0]->__toString());
|
||||||
return $mtime->format('U');
|
return $mtime->format('U');
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class ArchiverContext implements Context {
|
|||||||
public function getArchiverQueryString(
|
public function getArchiverQueryString(
|
||||||
string $user,
|
string $user,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $addressType
|
string $addressType,
|
||||||
): string {
|
): string {
|
||||||
switch ($addressType) {
|
switch ($addressType) {
|
||||||
case 'id':
|
case 'id':
|
||||||
@@ -128,7 +128,7 @@ class ArchiverContext implements Context {
|
|||||||
default:
|
default:
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
'"' . $addressType .
|
'"' . $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 $archiveType,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $addressType,
|
string $addressType,
|
||||||
TableNode $headersTable
|
TableNode $headersTable,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->verifyTableNodeColumns(
|
$this->featureContext->verifyTableNodeColumns(
|
||||||
$headersTable,
|
$headersTable,
|
||||||
['header', 'value']
|
['header', 'value'],
|
||||||
);
|
);
|
||||||
$headers = [];
|
$headers = [];
|
||||||
foreach ($headersTable as $row) {
|
foreach ($headersTable as $row) {
|
||||||
$headers[$row['header']] = $row ['value'];
|
$headers[$row['header']] = $row ['value'];
|
||||||
}
|
}
|
||||||
$this->featureContext->setResponse(
|
$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 $downloader,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $owner,
|
string $owner,
|
||||||
string $addressType
|
string $addressType,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse($this->downloadArchive($downloader, $resource, $addressType, null, $owner));
|
$this->featureContext->setResponse($this->downloadArchive($downloader, $resource, $addressType, null, $owner));
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ class ArchiverContext implements Context {
|
|||||||
string $addressType,
|
string $addressType,
|
||||||
?string $archiveType = null,
|
?string $archiveType = null,
|
||||||
?string $owner = null,
|
?string $owner = null,
|
||||||
?array $headers = null
|
?array $headers = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$owner = $owner ?? $downloader;
|
$owner = $owner ?? $downloader;
|
||||||
$downloader = $this->featureContext->getActualUsername($downloader);
|
$downloader = $this->featureContext->getActualUsername($downloader);
|
||||||
@@ -219,7 +219,7 @@ class ArchiverContext implements Context {
|
|||||||
$this->getArchiverUrl($queryString),
|
$this->getArchiverUrl($queryString),
|
||||||
$downloader,
|
$downloader,
|
||||||
$this->featureContext->getPasswordForUser($downloader),
|
$this->featureContext->getPasswordForUser($downloader),
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ class ArchiverContext implements Context {
|
|||||||
public function userDownloadsTheArchiveOfTheseItems(
|
public function userDownloadsTheArchiveOfTheseItems(
|
||||||
string $user,
|
string $user,
|
||||||
string $addressType,
|
string $addressType,
|
||||||
TableNode $items
|
TableNode $items,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$queryString = [];
|
$queryString = [];
|
||||||
@@ -252,7 +252,7 @@ class ArchiverContext implements Context {
|
|||||||
$this->getArchiverUrl($queryString),
|
$this->getArchiverUrl($queryString),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,12 +302,12 @@ class ArchiverContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$expectedItem['content'],
|
$expectedItem['content'],
|
||||||
$fileContent,
|
$fileContent,
|
||||||
__METHOD__ . " content of '" . $expectedPath . "' not as expected"
|
__METHOD__ . " content of '" . $expectedPath . "' not as expected",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Assert::assertFileExists(
|
Assert::assertFileExists(
|
||||||
$fileFullPath,
|
$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->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
["expiry" => $expiration],
|
["expiry" => $expiration],
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ class AuthAppContext implements Context {
|
|||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
["expiry" => $expiration]
|
["expiry" => $expiration],
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
$this->lastCreatedToken = [
|
$this->lastCreatedToken = [
|
||||||
@@ -130,7 +130,7 @@ class AuthAppContext implements Context {
|
|||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ class AuthAppContext implements Context {
|
|||||||
200,
|
200,
|
||||||
"Failed creating auth-app token\n"
|
"Failed creating auth-app token\n"
|
||||||
. "HTTP status code 200 is not the expected value " . $response->getStatusCode(),
|
. "HTTP status code 200 is not the expected value " . $response->getStatusCode(),
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
$this->lastCreatedToken = [
|
$this->lastCreatedToken = [
|
||||||
"user" => strtolower($impersonatedUser),
|
"user" => strtolower($impersonatedUser),
|
||||||
@@ -192,7 +192,7 @@ class AuthAppContext implements Context {
|
|||||||
"expiry" => $expiration,
|
"expiry" => $expiration,
|
||||||
"userName" => $this->featureContext->getActualUsername($impersonatedUser),
|
"userName" => $this->featureContext->getActualUsername($impersonatedUser),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ class AuthAppContext implements Context {
|
|||||||
$response = AuthAppHelper::listAllAppAuthTokensForUser(
|
$response = AuthAppHelper::listAllAppAuthTokensForUser(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
$user,
|
$user,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$authAppTokens = json_decode($response->getBody()->getContents());
|
$authAppTokens = json_decode($response->getBody()->getContents());
|
||||||
foreach ($authAppTokens as $tokenObj) {
|
foreach ($authAppTokens as $tokenObj) {
|
||||||
@@ -218,7 +218,7 @@ class AuthAppContext implements Context {
|
|||||||
$baseUrl,
|
$baseUrl,
|
||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$tokenObj->token
|
$tokenObj->token,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($deleteResponse);
|
$this->featureContext->setResponse($deleteResponse);
|
||||||
$this->featureContext->pushToLastHttpStatusCodesArray((string)$deleteResponse->getStatusCode());
|
$this->featureContext->pushToLastHttpStatusCodesArray((string)$deleteResponse->getStatusCode());
|
||||||
@@ -243,7 +243,7 @@ class AuthAppContext implements Context {
|
|||||||
Assert::assertCount(
|
Assert::assertCount(
|
||||||
$count,
|
$count,
|
||||||
$authAppTokens,
|
$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(
|
public function userCreatesAppTokenWithUserIdForUserWithExpirationTimeUsingTheAuthAppApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $impersonatedUser,
|
string $impersonatedUser,
|
||||||
string $expiration
|
string $expiration,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
AuthAppHelper::createAppAuthToken(
|
AuthAppHelper::createAppAuthToken(
|
||||||
@@ -271,7 +271,7 @@ class AuthAppContext implements Context {
|
|||||||
"expiry" => $expiration,
|
"expiry" => $expiration,
|
||||||
"userID" => $this->featureContext->getUserIdByUserName($impersonatedUser),
|
"userID" => $this->featureContext->getUserIdByUserName($impersonatedUser),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class AuthContext implements Context {
|
|||||||
string $url,
|
string $url,
|
||||||
string $method,
|
string $method,
|
||||||
?string $body = null,
|
?string $body = null,
|
||||||
?array $headers = []
|
?array $headers = [],
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
// NOTE: preserving '/' for tests with special cases
|
// NOTE: preserving '/' for tests with special cases
|
||||||
// E.g: coreApiAuth/webDavSpecialURLs.feature
|
// E.g: coreApiAuth/webDavSpecialURLs.feature
|
||||||
@@ -110,12 +110,12 @@ class AuthContext implements Context {
|
|||||||
string $method,
|
string $method,
|
||||||
?string $body = null,
|
?string $body = null,
|
||||||
?array $headers = null,
|
?array $headers = null,
|
||||||
?string $property = null
|
?string $property = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$url = $this->featureContext->substituteInLineCodes(
|
$url = $this->featureContext->substituteInLineCodes(
|
||||||
$url,
|
$url,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
$authHeader = $this->createBasicAuthHeader($user, $this->featureContext->getPasswordForUser($user));
|
$authHeader = $this->createBasicAuthHeader($user, $this->featureContext->getPasswordForUser($user));
|
||||||
$headers = \array_merge($headers ?? [], $authHeader);
|
$headers = \array_merge($headers ?? [], $authHeader);
|
||||||
@@ -128,7 +128,7 @@ class AuthContext implements Context {
|
|||||||
$url,
|
$url,
|
||||||
$method,
|
$method,
|
||||||
$body,
|
$body,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,14 +159,14 @@ class AuthContext implements Context {
|
|||||||
string $method,
|
string $method,
|
||||||
string $body,
|
string $body,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$ofUser = \strtolower($this->featureContext->getActualUsername($ofUser));
|
$ofUser = \strtolower($this->featureContext->getActualUsername($ofUser));
|
||||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
$response = $this->sendRequest($row['endpoint'], $method, $body);
|
$response = $this->sendRequest($row['endpoint'], $method, $body);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -187,14 +187,14 @@ class AuthContext implements Context {
|
|||||||
public function userRequestsEndpointsWithoutBodyAndNoAuthAboutUser(
|
public function userRequestsEndpointsWithoutBodyAndNoAuthAboutUser(
|
||||||
string $method,
|
string $method,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$ofUser = \strtolower($this->featureContext->getActualUsername($ofUser));
|
$ofUser = \strtolower($this->featureContext->getActualUsername($ofUser));
|
||||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
$response = $this->sendRequest($row['endpoint'], $method);
|
$response = $this->sendRequest($row['endpoint'], $method);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -217,8 +217,8 @@ class AuthContext implements Context {
|
|||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->sendRequest(
|
$this->sendRequest(
|
||||||
$this->featureContext->substituteInLineCodes($row['endpoint']),
|
$this->featureContext->substituteInLineCodes($row['endpoint']),
|
||||||
$method
|
$method,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
}
|
}
|
||||||
@@ -239,8 +239,8 @@ class AuthContext implements Context {
|
|||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
HttpRequestHelper::sendRequest(
|
HttpRequestHelper::sendRequest(
|
||||||
$this->featureContext->substituteInLineCodes($row['endpoint']),
|
$this->featureContext->substituteInLineCodes($row['endpoint']),
|
||||||
$method
|
$method,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
}
|
}
|
||||||
@@ -282,14 +282,14 @@ class AuthContext implements Context {
|
|||||||
string $method,
|
string $method,
|
||||||
string $property,
|
string $property,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||||
|
|
||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
$response = $this->requestUrlWithBasicAuth($user, $row['endpoint'], $method, null, null, $property);
|
$response = $this->requestUrlWithBasicAuth($user, $row['endpoint'], $method, null, null, $property);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -312,7 +312,7 @@ class AuthContext implements Context {
|
|||||||
$response = $this->requestUrlWithBasicAuth(
|
$response = $this->requestUrlWithBasicAuth(
|
||||||
$this->featureContext->getAdminUsername(),
|
$this->featureContext->getAdminUsername(),
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$method
|
$method,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
@@ -331,7 +331,7 @@ class AuthContext implements Context {
|
|||||||
public function userRequestsURLUsingBasicAuth(
|
public function userRequestsURLUsingBasicAuth(
|
||||||
string $user,
|
string $user,
|
||||||
string $url,
|
string $url,
|
||||||
string $method
|
string $method,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->requestUrlWithBasicAuth($user, $url, $method);
|
$response = $this->requestUrlWithBasicAuth($user, $url, $method);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -352,16 +352,16 @@ class AuthContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $url,
|
string $url,
|
||||||
string $method,
|
string $method,
|
||||||
TableNode $headersTable
|
TableNode $headersTable,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$url = $this->featureContext->substituteInLineCodes(
|
$url = $this->featureContext->substituteInLineCodes(
|
||||||
$url,
|
$url,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
$this->featureContext->verifyTableNodeColumns(
|
$this->featureContext->verifyTableNodeColumns(
|
||||||
$headersTable,
|
$headersTable,
|
||||||
['header', 'value']
|
['header', 'value'],
|
||||||
);
|
);
|
||||||
$headers = [];
|
$headers = [];
|
||||||
foreach ($headersTable as $row) {
|
foreach ($headersTable as $row) {
|
||||||
@@ -373,8 +373,8 @@ class AuthContext implements Context {
|
|||||||
$url,
|
$url,
|
||||||
$method,
|
$method,
|
||||||
null,
|
null,
|
||||||
$headers
|
$headers,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ class AuthContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $method,
|
string $method,
|
||||||
string $password,
|
string $password,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||||
@@ -424,7 +424,7 @@ class AuthContext implements Context {
|
|||||||
string $method,
|
string $method,
|
||||||
string $password,
|
string $password,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||||
@@ -435,12 +435,12 @@ class AuthContext implements Context {
|
|||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
if (isset($row['destination'])) {
|
if (isset($row['destination'])) {
|
||||||
$destination = $this->featureContext->substituteInLineCodes(
|
$destination = $this->featureContext->substituteInLineCodes(
|
||||||
$row['destination'],
|
$row['destination'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
$headers['Destination'] = $this->featureContext->getBaseUrl()
|
$headers['Destination'] = $this->featureContext->getBaseUrl()
|
||||||
. "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/"));
|
. "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/"));
|
||||||
@@ -449,7 +449,7 @@ class AuthContext implements Context {
|
|||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$method,
|
$method,
|
||||||
null,
|
null,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
@@ -475,7 +475,7 @@ class AuthContext implements Context {
|
|||||||
string $body,
|
string $body,
|
||||||
string $password,
|
string $password,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||||
@@ -486,12 +486,12 @@ class AuthContext implements Context {
|
|||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
if (isset($row['destination'])) {
|
if (isset($row['destination'])) {
|
||||||
$destination = $this->featureContext->substituteInLineCodes(
|
$destination = $this->featureContext->substituteInLineCodes(
|
||||||
$row['destination'],
|
$row['destination'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
$headers['Destination'] = $this->featureContext->getBaseUrl()
|
$headers['Destination'] = $this->featureContext->getBaseUrl()
|
||||||
. "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/"));
|
. "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/"));
|
||||||
@@ -500,7 +500,7 @@ class AuthContext implements Context {
|
|||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$method,
|
$method,
|
||||||
$body,
|
$body,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
@@ -524,7 +524,7 @@ class AuthContext implements Context {
|
|||||||
string $method,
|
string $method,
|
||||||
string $body,
|
string $body,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||||
@@ -538,14 +538,14 @@ class AuthContext implements Context {
|
|||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
$response = $this->requestUrlWithBasicAuth(
|
$response = $this->requestUrlWithBasicAuth(
|
||||||
$user,
|
$user,
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$method,
|
$method,
|
||||||
$body,
|
$body,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
@@ -568,7 +568,7 @@ class AuthContext implements Context {
|
|||||||
string $asUser,
|
string $asUser,
|
||||||
string $method,
|
string $method,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$asUser = $this->featureContext->getActualUsername($asUser);
|
$asUser = $this->featureContext->getActualUsername($asUser);
|
||||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||||
@@ -580,13 +580,13 @@ class AuthContext implements Context {
|
|||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
$response = $this->sendRequest(
|
$response = $this->sendRequest(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$method,
|
$method,
|
||||||
null,
|
null,
|
||||||
$authHeader
|
$authHeader,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
@@ -610,7 +610,7 @@ class AuthContext implements Context {
|
|||||||
string $method,
|
string $method,
|
||||||
?string $body,
|
?string $body,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$asUser = $this->featureContext->getActualUsername($asUser);
|
$asUser = $this->featureContext->getActualUsername($asUser);
|
||||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||||
@@ -622,13 +622,13 @@ class AuthContext implements Context {
|
|||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
$response = $this->sendRequest(
|
$response = $this->sendRequest(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$method,
|
$method,
|
||||||
$body,
|
$body,
|
||||||
$authHeader
|
$authHeader,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
@@ -650,7 +650,7 @@ class AuthContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $method,
|
string $method,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$headers = [];
|
$headers = [];
|
||||||
if ($method === 'MOVE' || $method === 'COPY') {
|
if ($method === 'MOVE' || $method === 'COPY') {
|
||||||
@@ -666,14 +666,14 @@ class AuthContext implements Context {
|
|||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$ofUser
|
$ofUser,
|
||||||
);
|
);
|
||||||
$response = $this->requestUrlWithBasicAuth(
|
$response = $this->requestUrlWithBasicAuth(
|
||||||
$user,
|
$user,
|
||||||
$row['endpoint'],
|
$row['endpoint'],
|
||||||
$method,
|
$method,
|
||||||
null,
|
null,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
@@ -692,12 +692,12 @@ class AuthContext implements Context {
|
|||||||
public function userRequestsURLWithoutRetry(
|
public function userRequestsURLWithoutRetry(
|
||||||
string $user,
|
string $user,
|
||||||
string $endpoint,
|
string $endpoint,
|
||||||
string $method
|
string $method,
|
||||||
): void {
|
): void {
|
||||||
$username = $this->featureContext->getActualUsername($user);
|
$username = $this->featureContext->getActualUsername($user);
|
||||||
$endpoint = $this->featureContext->substituteInLineCodes(
|
$endpoint = $this->featureContext->substituteInLineCodes(
|
||||||
$endpoint,
|
$endpoint,
|
||||||
$username
|
$username,
|
||||||
);
|
);
|
||||||
$endpoint = \ltrim($endpoint, '/');
|
$endpoint = \ltrim($endpoint, '/');
|
||||||
if (WebdavHelper::isDAVRequest($endpoint)) {
|
if (WebdavHelper::isDAVRequest($endpoint)) {
|
||||||
@@ -708,7 +708,7 @@ class AuthContext implements Context {
|
|||||||
$fullUrl,
|
$fullUrl,
|
||||||
$method,
|
$method,
|
||||||
$username,
|
$username,
|
||||||
$this->featureContext->getPasswordForUser($user)
|
$this->featureContext->getPasswordForUser($user),
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class CapabilitiesContext implements Context {
|
|||||||
'GET',
|
'GET',
|
||||||
'/cloud/capabilities' . ($formatJson ? '?format=json' : ''),
|
'/cloud/capabilities' . ($formatJson ? '?format=json' : ''),
|
||||||
[],
|
[],
|
||||||
$this->featureContext->getOcsApiVersion()
|
$this->featureContext->getOcsApiVersion(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ class CapabilitiesContext implements Context {
|
|||||||
public function getParameterValueFromXml(
|
public function getParameterValueFromXml(
|
||||||
SimpleXMLElement $xml,
|
SimpleXMLElement $xml,
|
||||||
string $capabilitiesApp,
|
string $capabilitiesApp,
|
||||||
string $capabilitiesPath
|
string $capabilitiesPath,
|
||||||
): string {
|
): string {
|
||||||
$path_to_element = \explode('@@@', $capabilitiesPath);
|
$path_to_element = \explode('@@@', $capabilitiesPath);
|
||||||
$answeredValue = $xml->{$capabilitiesApp};
|
$answeredValue = $xml->{$capabilitiesApp};
|
||||||
@@ -172,7 +172,7 @@ class CapabilitiesContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
1,
|
1,
|
||||||
$result,
|
$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 should have an array with the 3 semver components of the version, e.g. "1", "9" and "2".
|
||||||
$semVerParts = \explode('.', $matches[0]);
|
$semVerParts = \explode('.', $matches[0]);
|
||||||
@@ -185,17 +185,17 @@ class CapabilitiesContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$expectedMajor,
|
$expectedMajor,
|
||||||
$actualMajor,
|
$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(
|
Assert::assertSame(
|
||||||
$expectedMinor,
|
$expectedMinor,
|
||||||
$actualMinor,
|
$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(
|
Assert::assertSame(
|
||||||
$expectedMicro,
|
$expectedMicro,
|
||||||
$actualMicro,
|
$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(
|
$edition = $this->getParameterValueFromXml(
|
||||||
$responseXmlObject,
|
$responseXmlObject,
|
||||||
'core',
|
'core',
|
||||||
'status@@@edition'
|
'status@@@edition',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!\strlen($edition)) {
|
if (!\strlen($edition)) {
|
||||||
Assert::fail(
|
Assert::fail(
|
||||||
"Cannot get edition from core capabilities"
|
"Cannot get edition from core capabilities",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$product = $this->getParameterValueFromXml(
|
$product = $this->getParameterValueFromXml(
|
||||||
$responseXmlObject,
|
$responseXmlObject,
|
||||||
'core',
|
'core',
|
||||||
'status@@@product'
|
'status@@@product',
|
||||||
);
|
);
|
||||||
if (!\strlen($product)) {
|
if (!\strlen($product)) {
|
||||||
Assert::fail(
|
Assert::fail(
|
||||||
"Cannot get product from core capabilities"
|
"Cannot get product from core capabilities",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$productName = $this->getParameterValueFromXml(
|
$productName = $this->getParameterValueFromXml(
|
||||||
$responseXmlObject,
|
$responseXmlObject,
|
||||||
'core',
|
'core',
|
||||||
'status@@@productname'
|
'status@@@productname',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!\strlen($productName)) {
|
if (!\strlen($productName)) {
|
||||||
Assert::fail(
|
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(
|
$version = $this->getParameterValueFromXml(
|
||||||
$responseXmlObject,
|
$responseXmlObject,
|
||||||
'core',
|
'core',
|
||||||
'status@@@version'
|
'status@@@version',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!\strlen($version)) {
|
if (!\strlen($version)) {
|
||||||
Assert::fail(
|
Assert::fail(
|
||||||
"Cannot get version from core capabilities"
|
"Cannot get version from core capabilities",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$versionString = $this->getParameterValueFromXml(
|
$versionString = $this->getParameterValueFromXml(
|
||||||
$responseXmlObject,
|
$responseXmlObject,
|
||||||
'core',
|
'core',
|
||||||
'status@@@versionstring'
|
'status@@@versionstring',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!\strlen($versionString)) {
|
if (!\strlen($versionString)) {
|
||||||
Assert::fail(
|
Assert::fail(
|
||||||
"Cannot get versionstring from core capabilities"
|
"Cannot get versionstring from core capabilities",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ class CapabilitiesContext implements Context {
|
|||||||
Assert::assertMatchesRegularExpression(
|
Assert::assertMatchesRegularExpression(
|
||||||
"/^\d+\.\d+\.\d+\.\d+$/",
|
"/^\d+\.\d+\.\d+\.\d+$/",
|
||||||
$version,
|
$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)) {
|
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.
|
// 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(
|
Assert::assertArrayHasKey(
|
||||||
1,
|
1,
|
||||||
$matches,
|
$matches,
|
||||||
"version $version could not match the pattern Major.Minor.Patch"
|
"version $version could not match the pattern Major.Minor.Patch",
|
||||||
);
|
);
|
||||||
$majorMinorPatchVersion = $matches[1];
|
$majorMinorPatchVersion = $matches[1];
|
||||||
} else {
|
} else {
|
||||||
@@ -323,7 +323,7 @@ class CapabilitiesContext implements Context {
|
|||||||
Assert::assertStringStartsWith(
|
Assert::assertStringStartsWith(
|
||||||
$majorMinorPatchVersion,
|
$majorMinorPatchVersion,
|
||||||
$versionString,
|
$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 $user,
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $checksum
|
string $checksum,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$file = \file_get_contents(
|
$file = \file_get_contents(
|
||||||
$this->featureContext->acceptanceTestsDirLocation() . $source
|
$this->featureContext->acceptanceTestsDirLocation() . $source,
|
||||||
);
|
);
|
||||||
return $this->featureContext->makeDavRequest(
|
return $this->featureContext->makeDavRequest(
|
||||||
$user,
|
$user,
|
||||||
'PUT',
|
'PUT',
|
||||||
$destination,
|
$destination,
|
||||||
['OC-Checksum' => $checksum],
|
['OC-Checksum' => $checksum],
|
||||||
$file
|
$file,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,10 +74,10 @@ class ChecksumContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $checksum
|
string $checksum,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$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 $user,
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $checksum
|
string $checksum,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$response = $this->uploadFileToWithChecksumUsingTheAPI(
|
$response = $this->uploadFileToWithChecksumUsingTheAPI(
|
||||||
$user,
|
$user,
|
||||||
$source,
|
$source,
|
||||||
$destination,
|
$destination,
|
||||||
$checksum
|
$checksum,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe([201,204], '', $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe([201,204], '', $response);
|
||||||
}
|
}
|
||||||
@@ -119,14 +119,14 @@ class ChecksumContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $content,
|
string $content,
|
||||||
string $checksum,
|
string $checksum,
|
||||||
string $destination
|
string $destination,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return $this->featureContext->makeDavRequest(
|
return $this->featureContext->makeDavRequest(
|
||||||
$user,
|
$user,
|
||||||
'PUT',
|
'PUT',
|
||||||
$destination,
|
$destination,
|
||||||
['OC-Checksum' => $checksum],
|
['OC-Checksum' => $checksum],
|
||||||
$content
|
$content,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ class ChecksumContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $content,
|
string $content,
|
||||||
string $checksum,
|
string $checksum,
|
||||||
string $destination
|
string $destination,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$response = $this->uploadFileWithContentAndChecksumToUsingTheAPI($user, $content, $checksum, $destination);
|
$response = $this->uploadFileWithContentAndChecksumToUsingTheAPI($user, $content, $checksum, $destination);
|
||||||
@@ -188,7 +188,7 @@ class ChecksumContext implements Context {
|
|||||||
null,
|
null,
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->getDavPathVersion()
|
$this->featureContext->getDavPathVersion(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ class ChecksumContext implements Context {
|
|||||||
public function asUserTheWebdavChecksumOfPathViaPropfindShouldMatch(
|
public function asUserTheWebdavChecksumOfPathViaPropfindShouldMatch(
|
||||||
string $user,
|
string $user,
|
||||||
string $path,
|
string $path,
|
||||||
string $expectedChecksum
|
string $expectedChecksum,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$resource = $this->propfindResourceChecksum($user, $path);
|
$resource = $this->propfindResourceChecksum($user, $path);
|
||||||
@@ -249,72 +249,72 @@ class ChecksumContext implements Context {
|
|||||||
Assert::assertIsArray(
|
Assert::assertIsArray(
|
||||||
$parsed,
|
$parsed,
|
||||||
__METHOD__
|
__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(
|
Assert::assertArrayHasKey(
|
||||||
0,
|
0,
|
||||||
$parsed,
|
$parsed,
|
||||||
__METHOD__ . " parsed XML does not have key 0"
|
__METHOD__ . " parsed XML does not have key 0",
|
||||||
);
|
);
|
||||||
$parsed0 = $parsed[0];
|
$parsed0 = $parsed[0];
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
'value',
|
'value',
|
||||||
$parsed0,
|
$parsed0,
|
||||||
__METHOD__ . " parsed XML parsed0 does not have key value"
|
__METHOD__ . " parsed XML parsed0 does not have key value",
|
||||||
);
|
);
|
||||||
$parsed0Value = $parsed0['value'];
|
$parsed0Value = $parsed0['value'];
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
1,
|
1,
|
||||||
$parsed0Value,
|
$parsed0Value,
|
||||||
__METHOD__ . " parsed XML parsed0Value does not have key 1"
|
__METHOD__ . " parsed XML parsed0Value does not have key 1",
|
||||||
);
|
);
|
||||||
$parsed0Value1 = $parsed0Value[1];
|
$parsed0Value1 = $parsed0Value[1];
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
'value',
|
'value',
|
||||||
$parsed0Value1,
|
$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'];
|
$parsed0Value1Value = $parsed0Value1['value'];
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
0,
|
0,
|
||||||
$parsed0Value1Value,
|
$parsed0Value1Value,
|
||||||
__METHOD__ . " parsed XML parsed0Value1Value does not have key 0"
|
__METHOD__ . " parsed XML parsed0Value1Value does not have key 0",
|
||||||
);
|
);
|
||||||
$parsed0Value1Value0 = $parsed0Value1Value[0];
|
$parsed0Value1Value0 = $parsed0Value1Value[0];
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
'value',
|
'value',
|
||||||
$parsed0Value1Value0,
|
$parsed0Value1Value0,
|
||||||
__METHOD__ . " parsed XML parsed0Value1Value0 does not have key value"
|
__METHOD__ . " parsed XML parsed0Value1Value0 does not have key value",
|
||||||
);
|
);
|
||||||
$parsed0Value1Value0Value = $parsed0Value1Value0['value'];
|
$parsed0Value1Value0Value = $parsed0Value1Value0['value'];
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
0,
|
0,
|
||||||
$parsed0Value1Value0Value,
|
$parsed0Value1Value0Value,
|
||||||
__METHOD__ . " parsed XML parsed0Value1Value0Value does not have key 0"
|
__METHOD__ . " parsed XML parsed0Value1Value0Value does not have key 0",
|
||||||
);
|
);
|
||||||
$checksums = $parsed0Value1Value0Value[0];
|
$checksums = $parsed0Value1Value0Value[0];
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
'value',
|
'value',
|
||||||
$checksums,
|
$checksums,
|
||||||
__METHOD__ . " parsed XML checksums does not have key value"
|
__METHOD__ . " parsed XML checksums does not have key value",
|
||||||
);
|
);
|
||||||
$checksumsValue = $checksums['value'];
|
$checksumsValue = $checksums['value'];
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
0,
|
0,
|
||||||
$checksumsValue,
|
$checksumsValue,
|
||||||
__METHOD__ . " parsed XML checksumsValue does not have key 0"
|
__METHOD__ . " parsed XML checksumsValue does not have key 0",
|
||||||
);
|
);
|
||||||
$checksumsValue0 = $checksumsValue[0];
|
$checksumsValue0 = $checksumsValue[0];
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
'value',
|
'value',
|
||||||
$checksumsValue0,
|
$checksumsValue0,
|
||||||
__METHOD__ . " parsed XML checksumsValue0 does not have key value"
|
__METHOD__ . " parsed XML checksumsValue0 does not have key value",
|
||||||
);
|
);
|
||||||
$actualChecksum = $checksumsValue0['value'];
|
$actualChecksum = $checksumsValue0['value'];
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$expectedChecksum,
|
$expectedChecksum,
|
||||||
$actualChecksum,
|
$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(
|
Assert::assertIsArray(
|
||||||
$headerChecksums,
|
$headerChecksums,
|
||||||
__METHOD__ . " getHeader('OC-Checksum') did not return an array"
|
__METHOD__ . " getHeader('OC-Checksum') did not return an array",
|
||||||
);
|
);
|
||||||
|
|
||||||
Assert::assertNotEmpty(
|
Assert::assertNotEmpty(
|
||||||
$headerChecksums,
|
$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);
|
$checksumCount = \count($headerChecksums);
|
||||||
|
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$checksumCount === 1,
|
$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
|
$headerChecksum
|
||||||
@@ -352,7 +352,7 @@ class ChecksumContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$expectedChecksum,
|
$expectedChecksum,
|
||||||
$headerChecksum,
|
$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(
|
public function theHeaderChecksumWhenUserDownloadsFileUsingTheWebdavApiShouldMatch(
|
||||||
string $user,
|
string $user,
|
||||||
string $fileName,
|
string $fileName,
|
||||||
string $expectedChecksum
|
string $expectedChecksum,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName);
|
$response = $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName);
|
||||||
$headerChecksums = $response->getHeader('OC-Checksum');
|
$headerChecksums = $response->getHeader('OC-Checksum');
|
||||||
|
|
||||||
Assert::assertIsArray(
|
Assert::assertIsArray(
|
||||||
$headerChecksums,
|
$headerChecksums,
|
||||||
__METHOD__ . " getHeader('OC-Checksum') did not return an array"
|
__METHOD__ . " getHeader('OC-Checksum') did not return an array",
|
||||||
);
|
);
|
||||||
|
|
||||||
Assert::assertNotEmpty(
|
Assert::assertNotEmpty(
|
||||||
$headerChecksums,
|
$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);
|
$checksumCount = \count($headerChecksums);
|
||||||
|
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$checksumCount === 1,
|
$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
|
$headerChecksum
|
||||||
@@ -396,7 +396,7 @@ class ChecksumContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$expectedChecksum,
|
$expectedChecksum,
|
||||||
$headerChecksum,
|
$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,
|
int $total,
|
||||||
string $data,
|
string $data,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $expectedChecksum
|
string $expectedChecksum,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$num -= 1;
|
$num -= 1;
|
||||||
@@ -426,7 +426,7 @@ class ChecksumContext implements Context {
|
|||||||
'PUT',
|
'PUT',
|
||||||
$file,
|
$file,
|
||||||
['OC-Checksum' => $expectedChecksum, 'OC-Chunked' => '1'],
|
['OC-Checksum' => $expectedChecksum, 'OC-Chunked' => '1'],
|
||||||
$data
|
$data,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,7 +448,7 @@ class ChecksumContext implements Context {
|
|||||||
int $total,
|
int $total,
|
||||||
string $data,
|
string $data,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $expectedChecksum
|
string $expectedChecksum,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->uploadChunkFileOfWithToWithChecksum(
|
$response = $this->uploadChunkFileOfWithToWithChecksum(
|
||||||
$user,
|
$user,
|
||||||
@@ -456,7 +456,7 @@ class ChecksumContext implements Context {
|
|||||||
$total,
|
$total,
|
||||||
$data,
|
$data,
|
||||||
$destination,
|
$destination,
|
||||||
$expectedChecksum
|
$expectedChecksum,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -479,7 +479,7 @@ class ChecksumContext implements Context {
|
|||||||
int $total,
|
int $total,
|
||||||
string $data,
|
string $data,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $expectedChecksum
|
string $expectedChecksum,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->uploadChunkFileOfWithToWithChecksum(
|
$response = $this->uploadChunkFileOfWithToWithChecksum(
|
||||||
$user,
|
$user,
|
||||||
@@ -487,12 +487,12 @@ class ChecksumContext implements Context {
|
|||||||
$total,
|
$total,
|
||||||
$data,
|
$data,
|
||||||
$destination,
|
$destination,
|
||||||
$expectedChecksum
|
$expectedChecksum,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
[201, 206],
|
[201, 206],
|
||||||
'',
|
'',
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class CliContext implements Context {
|
|||||||
public function theAdministratorResetsThePasswordOfUserUsingTheCLI(
|
public function theAdministratorResetsThePasswordOfUserUsingTheCLI(
|
||||||
string $status,
|
string $status,
|
||||||
string $user,
|
string $user,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$command = "idm resetpassword -u $user";
|
$command = "idm resetpassword -u $user";
|
||||||
$body = [
|
$body = [
|
||||||
@@ -149,7 +149,7 @@ class CliContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theAdministratorCreatesAppTokenForUserWithExpirationTimeUsingTheAuthAppCLI(
|
public function theAdministratorCreatesAppTokenForUserWithExpirationTimeUsingTheAuthAppCLI(
|
||||||
string $user,
|
string $user,
|
||||||
string $expirationTime
|
string $expirationTime,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUserName($user);
|
$user = $this->featureContext->getActualUserName($user);
|
||||||
$command = "auth-app create --user-name=$user --expiration=$expirationTime";
|
$command = "auth-app create --user-name=$user --expiration=$expirationTime";
|
||||||
@@ -169,7 +169,7 @@ class CliContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theAdministratorHasCreatedAppTokenForUserWithExpirationTimeUsingTheAuthAppCli(
|
public function theAdministratorHasCreatedAppTokenForUserWithExpirationTimeUsingTheAuthAppCli(
|
||||||
$user,
|
$user,
|
||||||
$expirationTime
|
$expirationTime,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUserName($user);
|
$user = $this->featureContext->getActualUserName($user);
|
||||||
$command = "auth-app create --user-name=$user --expiration=$expirationTime";
|
$command = "auth-app create --user-name=$user --expiration=$expirationTime";
|
||||||
@@ -183,7 +183,7 @@ class CliContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
0,
|
0,
|
||||||
$jsonResponse["exitCode"],
|
$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");
|
$output = $this->featureContext->substituteInLineCodes("App token created for $user");
|
||||||
Assert::assertStringContainsString($output, $jsonResponse["message"]);
|
Assert::assertStringContainsString($output, $jsonResponse["message"]);
|
||||||
@@ -199,7 +199,7 @@ class CliContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userHasCreatedAppTokenWithExpirationTimeUsingTheAuthAppCLI(
|
public function userHasCreatedAppTokenWithExpirationTimeUsingTheAuthAppCLI(
|
||||||
string $user,
|
string $user,
|
||||||
string $expirationTime
|
string $expirationTime,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUserName($user);
|
$user = $this->featureContext->getActualUserName($user);
|
||||||
$command = "auth-app create --user-name=$user --expiration=$expirationTime";
|
$command = "auth-app create --user-name=$user --expiration=$expirationTime";
|
||||||
@@ -214,7 +214,7 @@ class CliContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
0,
|
0,
|
||||||
$jsonResponse["exitCode"],
|
$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(
|
Assert::assertSame(
|
||||||
$expectedExitCode,
|
$expectedExitCode,
|
||||||
$jsonResponse["exitCode"],
|
$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) {
|
foreach ($expectedFiles as $expectedFile) {
|
||||||
Assert::assertNotTrue(
|
Assert::assertNotTrue(
|
||||||
\in_array($expectedFile, $resourceNames),
|
\in_array($expectedFile, $resourceNames),
|
||||||
"The resource '$expectedFile' was found in the response."
|
"The resource '$expectedFile' was found in the response.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($expectedFiles as $expectedFile) {
|
foreach ($expectedFiles as $expectedFile) {
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
\in_array($expectedFile, $resourceNames),
|
\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(
|
public function theAdministratorListsTheStaleUploadsOfSpace(
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $user
|
string $user,
|
||||||
): void {
|
): void {
|
||||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||||
$user,
|
$user,
|
||||||
$spaceName
|
$spaceName,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($this->listStaleUploads($spaceOwnerId));
|
$this->featureContext->setResponse($this->listStaleUploads($spaceOwnerId));
|
||||||
}
|
}
|
||||||
@@ -611,7 +611,7 @@ class CliContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$expectedMessage,
|
$expectedMessage,
|
||||||
$actualMessage,
|
$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(
|
public function theAdministratorDeletesTheStaleUploadsOfSpaceOwnedByUser(
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $user
|
string $user,
|
||||||
): void {
|
): void {
|
||||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||||
$user,
|
$user,
|
||||||
$spaceName
|
$spaceName,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($this->deleteStaleUploads($spaceOwnerId));
|
$this->featureContext->setResponse($this->deleteStaleUploads($spaceOwnerId));
|
||||||
}
|
}
|
||||||
@@ -657,13 +657,13 @@ class CliContext implements Context {
|
|||||||
public function thereShouldBeStaleUploadsOfSpaceOwnedByUser(
|
public function thereShouldBeStaleUploadsOfSpaceOwnedByUser(
|
||||||
int $number,
|
int $number,
|
||||||
string $spaceName = '',
|
string $spaceName = '',
|
||||||
string $user = ''
|
string $user = '',
|
||||||
): void {
|
): void {
|
||||||
$spaceOwnerId = null;
|
$spaceOwnerId = null;
|
||||||
if ($spaceName !== '' && $user !== '') {
|
if ($spaceName !== '' && $user !== '') {
|
||||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||||
$user,
|
$user,
|
||||||
$spaceName
|
$spaceName,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -676,7 +676,7 @@ class CliContext implements Context {
|
|||||||
Assert::assertStringContainsString(
|
Assert::assertStringContainsString(
|
||||||
$expectedMessage,
|
$expectedMessage,
|
||||||
$jsonDecodedResponse->message ?? '',
|
$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(
|
public function theAdministratorListsAllTrashedResourceOfSpaceOwnedByUser(
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $user
|
string $user,
|
||||||
): void {
|
): void {
|
||||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||||
$user,
|
$user,
|
||||||
$spaceName
|
$spaceName,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($this->listTrashedResource($spaceOwnerId));
|
$this->featureContext->setResponse($this->listTrashedResource($spaceOwnerId));
|
||||||
}
|
}
|
||||||
@@ -719,7 +719,7 @@ class CliContext implements Context {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getTrashedResourceFromCliCommandResponse(
|
protected function getTrashedResourceFromCliCommandResponse(
|
||||||
ResponseInterface $response = null
|
ResponseInterface $response = null,
|
||||||
): array {
|
): array {
|
||||||
$responseArray = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
$responseArray = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
||||||
$lines = explode("\n", $responseArray->message);
|
$lines = explode("\n", $responseArray->message);
|
||||||
@@ -729,7 +729,7 @@ class CliContext implements Context {
|
|||||||
if (preg_match(
|
if (preg_match(
|
||||||
'/^\s*\|\s*([a-f0-9\-]{36})\s*\|\s*(.*?)\s*\|\s*(file|folder)\s*\|\s*([\d\-T:Z]+)\s*\|/',
|
'/^\s*\|\s*([a-f0-9\-]{36})\s*\|\s*(.*?)\s*\|\s*(file|folder)\s*\|\s*([\d\-T:Z]+)\s*\|/',
|
||||||
$line,
|
$line,
|
||||||
$matches
|
$matches,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$items[] = [
|
$items[] = [
|
||||||
@@ -757,7 +757,7 @@ class CliContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theCommandOutputShouldContainTheFollowingTrashResource(
|
public function theCommandOutputShouldContainTheFollowingTrashResource(
|
||||||
int $count,
|
int $count,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse();
|
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse();
|
||||||
|
|
||||||
@@ -777,7 +777,7 @@ class CliContext implements Context {
|
|||||||
|
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$matchFound,
|
$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(
|
public function theAdministratorRestoresAllTheTrashedResourcesOfSpaceOwnedByUser(
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $user
|
string $user,
|
||||||
): void {
|
): void {
|
||||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||||
$user,
|
$user,
|
||||||
$spaceName
|
$spaceName,
|
||||||
);
|
);
|
||||||
$body = [
|
$body = [
|
||||||
"command" => "storage-users trash-bin restore-all -y $spaceOwnerId",
|
"command" => "storage-users trash-bin restore-all -y $spaceOwnerId",
|
||||||
@@ -815,11 +815,11 @@ class CliContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function thereShouldBeNoTrashedResourcesOfSpaceOwnedByUser(
|
public function thereShouldBeNoTrashedResourcesOfSpaceOwnedByUser(
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $user
|
string $user,
|
||||||
): void {
|
): void {
|
||||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||||
$user,
|
$user,
|
||||||
$spaceName
|
$spaceName,
|
||||||
);
|
);
|
||||||
$response = $this->listTrashedResource($spaceOwnerId);
|
$response = $this->listTrashedResource($spaceOwnerId);
|
||||||
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse($response);
|
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse($response);
|
||||||
@@ -842,11 +842,11 @@ class CliContext implements Context {
|
|||||||
int $number,
|
int $number,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||||
$user,
|
$user,
|
||||||
$spaceName
|
$spaceName,
|
||||||
);
|
);
|
||||||
$response = $this->listTrashedResource($spaceOwnerId);
|
$response = $this->listTrashedResource($spaceOwnerId);
|
||||||
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse($response);
|
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse($response);
|
||||||
@@ -867,7 +867,7 @@ class CliContext implements Context {
|
|||||||
|
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$matchFound,
|
$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(
|
public function theAdministratorRestoresTheTrashedResourcesOfSpaceOwnedByUser(
|
||||||
string $resource,
|
string $resource,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $user
|
string $user,
|
||||||
): void {
|
): void {
|
||||||
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
$spaceOwnerId = $this->spacesContext->getSpaceOwnerUserIdByName(
|
||||||
$user,
|
$user,
|
||||||
$spaceName
|
$spaceName,
|
||||||
);
|
);
|
||||||
$response = $this->listTrashedResource($spaceOwnerId);
|
$response = $this->listTrashedResource($spaceOwnerId);
|
||||||
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse($response);
|
[$items, $totalCount] = $this->getTrashedResourceFromCliCommandResponse($response);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class CollaborationContext implements Context {
|
|||||||
string $file,
|
string $file,
|
||||||
string $space,
|
string $space,
|
||||||
string $app,
|
string $app,
|
||||||
string $viewMode = null
|
string $viewMode = null,
|
||||||
): void {
|
): void {
|
||||||
$fileId = $this->spacesContext->getFileId($user, $space, $file);
|
$fileId = $this->spacesContext->getFileId($user, $space, $file);
|
||||||
$response = \json_decode(
|
$response = \json_decode(
|
||||||
@@ -101,8 +101,8 @@ class CollaborationContext implements Context {
|
|||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$viewMode
|
$viewMode,
|
||||||
)->getBody()->getContents()
|
)->getBody()->getContents(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$accessToken = $response->form_parameters->access_token;
|
$accessToken = $response->form_parameters->access_token;
|
||||||
@@ -115,7 +115,7 @@ class CollaborationContext implements Context {
|
|||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
HttpRequestHelper::get(
|
HttpRequestHelper::get(
|
||||||
$wopiSrc . "?access_token=$accessToken",
|
$wopiSrc . "?access_token=$accessToken",
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ class CollaborationContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $folder,
|
string $folder,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$parentContainerId = $this->spacesContext->getResourceId($user, $space, $folder);
|
$parentContainerId = $this->spacesContext->getResourceId($user, $space, $folder);
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
@@ -144,8 +144,8 @@ class CollaborationContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$parentContainerId,
|
$parentContainerId,
|
||||||
$file
|
$file,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,8 +168,8 @@ class CollaborationContext implements Context {
|
|||||||
"$baseUrl/$davPath/$folder",
|
"$baseUrl/$davPath/$folder",
|
||||||
"PROPFIND",
|
"PROPFIND",
|
||||||
"public",
|
"public",
|
||||||
$this->featureContext->getActualPassword($password)
|
$this->featureContext->getActualPassword($password),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
$xmlPart = $responseXmlObject->xpath("//d:prop/oc:fileid");
|
$xmlPart = $responseXmlObject->xpath("//d:prop/oc:fileid");
|
||||||
$parentContainerId = (string) $xmlPart[0];
|
$parentContainerId = (string) $xmlPart[0];
|
||||||
@@ -184,8 +184,8 @@ class CollaborationContext implements Context {
|
|||||||
$this->featureContext->getActualPassword($password),
|
$this->featureContext->getActualPassword($password),
|
||||||
$parentContainerId,
|
$parentContainerId,
|
||||||
$file,
|
$file,
|
||||||
$headers
|
$headers,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ class CollaborationContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function thePublicCreatesAFileInsideTheLastSharedPublicLinkFolderWithPasswordUsingWopiEndpoint(
|
public function thePublicCreatesAFileInsideTheLastSharedPublicLinkFolderWithPasswordUsingWopiEndpoint(
|
||||||
string $file,
|
string $file,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$this->createFile($file, $password);
|
$this->createFile($file, $password);
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ class CollaborationContext implements Context {
|
|||||||
public function thePublicCreatesAFileInsideFolderInTheLastSharedPublicLinkSpaceWithPasswordUsingWopiEndpoint(
|
public function thePublicCreatesAFileInsideFolderInTheLastSharedPublicLinkSpaceWithPasswordUsingWopiEndpoint(
|
||||||
string $file,
|
string $file,
|
||||||
string $folder,
|
string $folder,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$this->createFile($file, $password, $folder);
|
$this->createFile($file, $password, $folder);
|
||||||
}
|
}
|
||||||
@@ -242,7 +242,7 @@ class CollaborationContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $space,
|
string $space,
|
||||||
string $app
|
string $app,
|
||||||
): void {
|
): void {
|
||||||
$response = \json_decode(
|
$response = \json_decode(
|
||||||
CollaborationHelper::sendPOSTRequestToAppOpen(
|
CollaborationHelper::sendPOSTRequestToAppOpen(
|
||||||
@@ -251,7 +251,7 @@ class CollaborationContext implements Context {
|
|||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
)->getBody()->getContents()
|
)->getBody()->getContents(),
|
||||||
);
|
);
|
||||||
$accessToken = $response->form_parameters->access_token;
|
$accessToken = $response->form_parameters->access_token;
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ class CollaborationContext implements Context {
|
|||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
HttpRequestHelper::get(
|
HttpRequestHelper::get(
|
||||||
$fullUrl . "?access_token=$accessToken",
|
$fullUrl . "?access_token=$accessToken",
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,8 +287,8 @@ class CollaborationContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$parentContainerId,
|
$parentContainerId,
|
||||||
$file
|
$file,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ class CollaborationContext implements Context {
|
|||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
HttpRequestHelper::get(
|
HttpRequestHelper::get(
|
||||||
$wopiSrc . "?access_token=$accessToken",
|
$wopiSrc . "?access_token=$accessToken",
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ class CollaborationContext implements Context {
|
|||||||
public function theFollowingMimeTypesShouldExistForUser(string $shouldOrNot, TableNode $table): void {
|
public function theFollowingMimeTypesShouldExistForUser(string $shouldOrNot, TableNode $table): void {
|
||||||
$rows = $table->getRows();
|
$rows = $table->getRows();
|
||||||
$responseArray = $this->featureContext->getJsonDecodedResponse(
|
$responseArray = $this->featureContext->getJsonDecodedResponse(
|
||||||
$this->featureContext->getResponse()
|
$this->featureContext->getResponse(),
|
||||||
)['mime-types'];
|
)['mime-types'];
|
||||||
$mimeTypes = \array_column($responseArray, 'mime_type');
|
$mimeTypes = \array_column($responseArray, 'mime_type');
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
@@ -359,13 +359,13 @@ class CollaborationContext implements Context {
|
|||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
\in_array($row[0], $mimeTypes),
|
\in_array($row[0], $mimeTypes),
|
||||||
"the response should not contain the mimetype $row[0].\nMime Types found in response:\n"
|
"the response should not contain the mimetype $row[0].\nMime Types found in response:\n"
|
||||||
. print_r($mimeTypes, true)
|
. print_r($mimeTypes, true),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
\in_array($row[0], $mimeTypes),
|
\in_array($row[0], $mimeTypes),
|
||||||
"the response does not contain the mimetype $row[0].\nMime Types found in response:\n"
|
"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(
|
public function theAppListResponseShouldContainTheFollowingTemplateInformationForOffice(
|
||||||
string $app,
|
string $app,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse());
|
$responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse());
|
||||||
|
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
"mime-types",
|
"mime-types",
|
||||||
$responseArray,
|
$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'];
|
$mimeTypes = $responseArray['mime-types'];
|
||||||
@@ -403,7 +403,7 @@ class CollaborationContext implements Context {
|
|||||||
$row['mime-type'],
|
$row['mime-type'],
|
||||||
$mimeTypeMap,
|
$mimeTypeMap,
|
||||||
"Expected mime-type '{$row['mime-type']}' to exist in the response but it doesn't.\n"
|
"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']];
|
$mimeType = $mimeTypeMap[$row['mime-type']];
|
||||||
@@ -415,7 +415,7 @@ class CollaborationContext implements Context {
|
|||||||
$row['target-extension'],
|
$row['target-extension'],
|
||||||
$provider['target_ext'],
|
$provider['target_ext'],
|
||||||
"Expected 'target_ext' for $app to be '{$row['target-extension']}'"
|
"Expected 'target_ext' for $app to be '{$row['target-extension']}'"
|
||||||
. " but found '{$provider['target_ext']}'"
|
. " but found '{$provider['target_ext']}'",
|
||||||
);
|
);
|
||||||
$found = true;
|
$found = true;
|
||||||
break;
|
break;
|
||||||
@@ -427,7 +427,7 @@ class CollaborationContext implements Context {
|
|||||||
"Expected response to contain app-provider '$app' with target-extension "
|
"Expected response to contain app-provider '$app' with target-extension "
|
||||||
. "'{$row['target-extension']}' for mime-type '{$row['mime-type']}',"
|
. "'{$row['target-extension']}' for mime-type '{$row['mime-type']}',"
|
||||||
. " but no matching provider was found.\n App Providers Found: "
|
. " 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,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$parentContainerId,
|
$parentContainerId,
|
||||||
$file
|
$file,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
$decodedResponse = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
$decodedResponse = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class EmailContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $sender,
|
string $sender,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
PyStringNode $content
|
PyStringNode $content,
|
||||||
): void {
|
): void {
|
||||||
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
@@ -75,7 +75,7 @@ class EmailContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
'',
|
'',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
||||||
$rawExpectedEmailBodyContent,
|
$rawExpectedEmailBodyContent,
|
||||||
@@ -88,7 +88,7 @@ class EmailContext implements Context {
|
|||||||
[$this->spacesContext, "getSpaceIdByName"],
|
[$this->spacesContext, "getSpaceIdByName"],
|
||||||
"parameter" => [$sender, $spaceName],
|
"parameter" => [$sender, $spaceName],
|
||||||
],
|
],
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
||||||
}
|
}
|
||||||
@@ -106,12 +106,12 @@ class EmailContext implements Context {
|
|||||||
public function userShouldHaveReceivedTheFollowingEmailFromUser(
|
public function userShouldHaveReceivedTheFollowingEmailFromUser(
|
||||||
string $user,
|
string $user,
|
||||||
string $sender,
|
string $sender,
|
||||||
PyStringNode $content
|
PyStringNode $content,
|
||||||
): void {
|
): void {
|
||||||
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
||||||
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
||||||
$rawExpectedEmailBodyContent,
|
$rawExpectedEmailBodyContent,
|
||||||
$sender
|
$sender,
|
||||||
);
|
);
|
||||||
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ class EmailContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$count,
|
$count,
|
||||||
$emails["messages_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(
|
public function userShouldHaveReceivedTheFollowingEmailFromUserIgnoringWhitespaces(
|
||||||
string $user,
|
string $user,
|
||||||
string $sender,
|
string $sender,
|
||||||
PyStringNode $content
|
PyStringNode $content,
|
||||||
): void {
|
): void {
|
||||||
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
||||||
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
||||||
$rawExpectedEmailBodyContent,
|
$rawExpectedEmailBodyContent,
|
||||||
$sender
|
$sender,
|
||||||
);
|
);
|
||||||
$this->assertEmailContains($user, $expectedEmailBodyContent, true);
|
$this->assertEmailContains($user, $expectedEmailBodyContent, true);
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,7 @@ class EmailContext implements Context {
|
|||||||
public function assertEmailContains(
|
public function assertEmailContains(
|
||||||
string $user,
|
string $user,
|
||||||
string $expectedEmailBodyContent,
|
string $expectedEmailBodyContent,
|
||||||
$ignoreWhiteSpace = false
|
$ignoreWhiteSpace = false,
|
||||||
): void {
|
): void {
|
||||||
$address = $this->featureContext->getEmailAddressForUser($user);
|
$address = $this->featureContext->getEmailAddressForUser($user);
|
||||||
$actualEmailBodyContent = $this->getBodyOfLastEmail($address);
|
$actualEmailBodyContent = $this->getBodyOfLastEmail($address);
|
||||||
@@ -193,7 +193,7 @@ class EmailContext implements Context {
|
|||||||
$actualEmailBodyContent,
|
$actualEmailBodyContent,
|
||||||
"The email address '$address' should have received an"
|
"The email address '$address' should have received an"
|
||||||
. "email with the body containing $expectedEmailBodyContent
|
. "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(
|
public function getBodyOfLastEmail(
|
||||||
string $emailAddress,
|
string $emailAddress,
|
||||||
?int $waitTimeSec = EMAIL_WAIT_TIMEOUT_SEC
|
?int $waitTimeSec = EMAIL_WAIT_TIMEOUT_SEC,
|
||||||
): string {
|
): string {
|
||||||
$currentTime = \time();
|
$currentTime = \time();
|
||||||
$endTime = $currentTime + $waitTimeSec;
|
$endTime = $currentTime + $waitTimeSec;
|
||||||
while ($currentTime <= $endTime) {
|
while ($currentTime <= $endTime) {
|
||||||
$query = 'to:' . $emailAddress;
|
$query = 'to:' . $emailAddress;
|
||||||
$mailResponse = $this->featureContext->getJsonDecodedResponse(
|
$mailResponse = $this->featureContext->getJsonDecodedResponse(
|
||||||
EmailHelper::searchEmails($query)
|
EmailHelper::searchEmails($query),
|
||||||
);
|
);
|
||||||
if ($mailResponse["messages_count"] > 0) {
|
if ($mailResponse["messages_count"] > 0) {
|
||||||
$lastEmail = $this->featureContext->getJsonDecodedResponse(
|
$lastEmail = $this->featureContext->getJsonDecodedResponse(
|
||||||
EmailHelper::getEmailById("latest", $query)
|
EmailHelper::getEmailById("latest", $query),
|
||||||
);
|
);
|
||||||
$body = \str_replace(
|
$body = \str_replace(
|
||||||
"\r\n",
|
"\r\n",
|
||||||
"\n",
|
"\n",
|
||||||
\quoted_printable_decode($lastEmail["Text"] . "\n" . $lastEmail["HTML"])
|
\quoted_printable_decode($lastEmail["Text"] . "\n" . $lastEmail["HTML"]),
|
||||||
);
|
);
|
||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
@@ -247,11 +247,11 @@ class EmailContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userShouldHaveReceivedTheFollowingGroupedEmail(
|
public function userShouldHaveReceivedTheFollowingGroupedEmail(
|
||||||
string $user,
|
string $user,
|
||||||
PyStringNode $content
|
PyStringNode $content,
|
||||||
): void {
|
): void {
|
||||||
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
||||||
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
||||||
$rawExpectedEmailBodyContent
|
$rawExpectedEmailBodyContent,
|
||||||
);
|
);
|
||||||
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class FavoritesContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$path,
|
$path,
|
||||||
1,
|
1,
|
||||||
$spaceId
|
$spaceId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,14 +115,14 @@ class FavoritesContext implements Context {
|
|||||||
public function checkFavoritedElements(
|
public function checkFavoritedElements(
|
||||||
string $user,
|
string $user,
|
||||||
string $shouldOrNot,
|
string $shouldOrNot,
|
||||||
TableNode $expectedElements
|
TableNode $expectedElements,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$this->userListsFavorites($user);
|
$this->userListsFavorites($user);
|
||||||
$this->featureContext->propfindResultShouldContainEntries(
|
$this->featureContext->propfindResultShouldContainEntries(
|
||||||
$shouldOrNot,
|
$shouldOrNot,
|
||||||
$expectedElements,
|
$expectedElements,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ class FavoritesContext implements Context {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->getDavPathVersion()
|
$this->featureContext->getDavPathVersion(),
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,7 @@ class FavoritesContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $path,
|
string $path,
|
||||||
int $expectedValue = 1,
|
int $expectedValue = 1,
|
||||||
string $spaceId = null
|
string $spaceId = null,
|
||||||
): void {
|
): void {
|
||||||
$property = "oc:favorite";
|
$property = "oc:favorite";
|
||||||
$this->webDavPropertiesContext->checkPropertyOfAFolder(
|
$this->webDavPropertiesContext->checkPropertyOfAFolder(
|
||||||
@@ -231,7 +231,7 @@ class FavoritesContext implements Context {
|
|||||||
"oc='http://owncloud.org/ns'",
|
"oc='http://owncloud.org/ns'",
|
||||||
$this->featureContext->getDavPathVersion(),
|
$this->featureContext->getDavPathVersion(),
|
||||||
'files',
|
'files',
|
||||||
$spaceId
|
$spaceId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ class FavoritesContext implements Context {
|
|||||||
$this->webDavPropertiesContext = BehatHelper::getContext(
|
$this->webDavPropertiesContext = BehatHelper::getContext(
|
||||||
$scope,
|
$scope,
|
||||||
$environment,
|
$environment,
|
||||||
'WebDavPropertiesContext'
|
'WebDavPropertiesContext',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,13 +259,13 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
*/
|
*/
|
||||||
public function pushToLastStatusCodesArrays(): void {
|
public function pushToLastStatusCodesArrays(): void {
|
||||||
$this->pushToLastHttpStatusCodesArray(
|
$this->pushToLastHttpStatusCodesArray(
|
||||||
(string)$this->getResponse()->getStatusCode()
|
(string)$this->getResponse()->getStatusCode(),
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
$this->pushToLastOcsCodesArray(
|
$this->pushToLastOcsCodesArray(
|
||||||
$this->ocsContext->getOCSResponseStatusCode(
|
$this->ocsContext->getOCSResponseStatusCode(
|
||||||
$this->getResponse()
|
$this->getResponse(),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
// if response couldn't be converted into xml then push "notset" to last ocs status codes array
|
// 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()) {
|
if (($this->userReplacements === null) && $this->isTestingReplacingUsernames()) {
|
||||||
$this->userReplacements = \json_decode(
|
$this->userReplacements = \json_decode(
|
||||||
\file_get_contents("./tests/acceptance/usernames.json"),
|
\file_get_contents("./tests/acceptance/usernames.json"),
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
// Loop through the user replacements, and make entries for the lower
|
// Loop through the user replacements, and make entries for the lower
|
||||||
// and upper case forms. This allows for steps that specifically
|
// and upper case forms. This allows for steps that specifically
|
||||||
@@ -413,14 +413,14 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
if ($lowerKey !== $key) {
|
if ($lowerKey !== $key) {
|
||||||
$this->userReplacements[$lowerKey] = $value;
|
$this->userReplacements[$lowerKey] = $value;
|
||||||
$this->userReplacements[$lowerKey]['username'] = \strtolower(
|
$this->userReplacements[$lowerKey]['username'] = \strtolower(
|
||||||
$this->userReplacements[$lowerKey]['username']
|
$this->userReplacements[$lowerKey]['username'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$upperKey = \strtoupper($key);
|
$upperKey = \strtoupper($key);
|
||||||
if ($upperKey !== $key) {
|
if ($upperKey !== $key) {
|
||||||
$this->userReplacements[$upperKey] = $value;
|
$this->userReplacements[$upperKey] = $value;
|
||||||
$this->userReplacements[$upperKey]['username'] = \strtoupper(
|
$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 {
|
public function addGuzzleClientHeaders(array $guzzleClientHeaders): void {
|
||||||
$this->guzzleClientHeaders = \array_merge(
|
$this->guzzleClientHeaders = \array_merge(
|
||||||
$this->guzzleClientHeaders,
|
$this->guzzleClientHeaders,
|
||||||
$guzzleClientHeaders
|
$guzzleClientHeaders,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -979,7 +979,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
*/
|
*/
|
||||||
public function setResponse(
|
public function setResponse(
|
||||||
?ResponseInterface $response,
|
?ResponseInterface $response,
|
||||||
string $username = ""
|
string $username = "",
|
||||||
): void {
|
): void {
|
||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
$this->responseUser = $username;
|
$this->responseUser = $username;
|
||||||
@@ -1023,7 +1023,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
Assert::assertContains(
|
Assert::assertContains(
|
||||||
\ltrim($validator, "$"),
|
\ltrim($validator, "$"),
|
||||||
$this->jsonSchemaValidators,
|
$this->jsonSchemaValidators,
|
||||||
"Invalid schema validator: '$validator'"
|
"Invalid schema validator: '$validator'",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1108,7 +1108,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$schemaObj->minItems,
|
$schemaObj->minItems,
|
||||||
$schemaObj->maxItems,
|
$schemaObj->maxItems,
|
||||||
"'minItems' and 'maxItems' should be equal for strict assertion"
|
"'minItems' and 'maxItems' should be equal for strict assertion",
|
||||||
);
|
);
|
||||||
|
|
||||||
// check optional validators
|
// check optional validators
|
||||||
@@ -1125,31 +1125,31 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
foreach ($value as $element) {
|
foreach ($value as $element) {
|
||||||
Assert::assertNotNull(
|
Assert::assertNotNull(
|
||||||
$element->oneOf,
|
$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::fail("'$validator' should be an object not an array");
|
||||||
}
|
}
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
$value->allOf || $value->anyOf,
|
$value->allOf || $value->anyOf,
|
||||||
"'allOf' and 'anyOf' are not allowed in array"
|
"'allOf' and 'anyOf' are not allowed in array",
|
||||||
);
|
);
|
||||||
if ($value->oneOf) {
|
if ($value->oneOf) {
|
||||||
Assert::assertNotNull(
|
Assert::assertNotNull(
|
||||||
$value->oneOf,
|
$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::assertTrue(\is_array($value->oneOf), "'oneOf' should be an array");
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$schemaObj->maxItems,
|
$schemaObj->maxItems,
|
||||||
\count($value->oneOf),
|
\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(
|
Assert::assertTrue(
|
||||||
\is_object($value),
|
\is_object($value),
|
||||||
"'$validator' should be an object when expecting 1 element"
|
"'$validator' should be an object when expecting 1 element",
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "uniqueItems":
|
case "uniqueItems":
|
||||||
@@ -1334,8 +1334,8 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
$method,
|
$method,
|
||||||
"public",
|
"public",
|
||||||
$password,
|
$password,
|
||||||
$headers
|
$headers,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1355,11 +1355,11 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
string $user,
|
string $user,
|
||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
TableNode $headersTable
|
TableNode $headersTable,
|
||||||
): void {
|
): void {
|
||||||
$this->verifyTableNodeColumns(
|
$this->verifyTableNodeColumns(
|
||||||
$headersTable,
|
$headersTable,
|
||||||
['header', 'value']
|
['header', 'value'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$user = $this->getActualUsername($user);
|
$user = $this->getActualUsername($user);
|
||||||
@@ -1386,7 +1386,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
function ($subArray) {
|
function ($subArray) {
|
||||||
return $subArray[0];
|
return $subArray[0];
|
||||||
},
|
},
|
||||||
$arrayOfArrays
|
$arrayOfArrays,
|
||||||
);
|
);
|
||||||
return $a;
|
return $a;
|
||||||
}
|
}
|
||||||
@@ -1405,7 +1405,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
string $user,
|
string $user,
|
||||||
string $method,
|
string $method,
|
||||||
string $davPath,
|
string $davPath,
|
||||||
string $content
|
string $content,
|
||||||
): void {
|
): void {
|
||||||
$this->setResponse($this->sendingToWithDirectUrl($user, $method, $davPath, $content));
|
$this->setResponse($this->sendingToWithDirectUrl($user, $method, $davPath, $content));
|
||||||
}
|
}
|
||||||
@@ -1424,7 +1424,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
string $user,
|
string $user,
|
||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$this->setResponse($this->sendingToWithDirectUrl($user, $verb, $url, null, $password));
|
$this->setResponse($this->sendingToWithDirectUrl($user, $verb, $url, null, $password));
|
||||||
}
|
}
|
||||||
@@ -1446,7 +1446,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
string $url,
|
string $url,
|
||||||
?string $body = null,
|
?string $body = null,
|
||||||
?string $password = null,
|
?string $password = null,
|
||||||
?array $headers = null
|
?array $headers = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$url = \ltrim($url, '/');
|
$url = \ltrim($url, '/');
|
||||||
if (WebdavHelper::isDAVRequest($url)) {
|
if (WebdavHelper::isDAVRequest($url)) {
|
||||||
@@ -1490,7 +1490,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
$reqHeaders,
|
$reqHeaders,
|
||||||
$body,
|
$body,
|
||||||
$config,
|
$config,
|
||||||
$cookies
|
$cookies,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1533,7 +1533,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
public function theHTTPStatusCodeShouldBe(
|
public function theHTTPStatusCodeShouldBe(
|
||||||
$expectedStatusCode,
|
$expectedStatusCode,
|
||||||
?string $message = "",
|
?string $message = "",
|
||||||
?ResponseInterface $response = null
|
?ResponseInterface $response = null,
|
||||||
): void {
|
): void {
|
||||||
$response = $response ?? $this->response;
|
$response = $response ?? $this->response;
|
||||||
$actualStatusCode = $response->getStatusCode();
|
$actualStatusCode = $response->getStatusCode();
|
||||||
@@ -1546,7 +1546,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
Assert::assertContainsEquals(
|
Assert::assertContainsEquals(
|
||||||
$actualStatusCode,
|
$actualStatusCode,
|
||||||
$expectedStatusCode,
|
$expectedStatusCode,
|
||||||
$message
|
$message,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ($message === "") {
|
if ($message === "") {
|
||||||
@@ -1556,7 +1556,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$expectedStatusCode,
|
$expectedStatusCode,
|
||||||
$actualStatusCode,
|
$actualStatusCode,
|
||||||
$message
|
$message,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1599,12 +1599,12 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function theOcsDataOfTheResponseShouldMatch(
|
public function theOcsDataOfTheResponseShouldMatch(
|
||||||
PyStringNode $schemaString
|
PyStringNode $schemaString,
|
||||||
): void {
|
): void {
|
||||||
$jsonResponse = $this->getJsonDecodedResponseBodyContent();
|
$jsonResponse = $this->getJsonDecodedResponseBodyContent();
|
||||||
$this->assertJsonDocumentMatchesSchema(
|
$this->assertJsonDocumentMatchesSchema(
|
||||||
$jsonResponse->ocs->data,
|
$jsonResponse->ocs->data,
|
||||||
$this->getJSONSchema($schemaString)
|
$this->getJSONSchema($schemaString),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1620,7 +1620,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
$responseBody = $this->getJsonDecodedResponseBodyContent();
|
$responseBody = $this->getJsonDecodedResponseBodyContent();
|
||||||
$this->assertJsonDocumentMatchesSchema(
|
$this->assertJsonDocumentMatchesSchema(
|
||||||
$responseBody,
|
$responseBody,
|
||||||
$this->getJSONSchema($schemaString)
|
$this->getJSONSchema($schemaString),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1645,7 +1645,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
*/
|
*/
|
||||||
public function theHTTPStatusCodeShouldBeOr($statusCode1, $statusCode2): void {
|
public function theHTTPStatusCodeShouldBeOr($statusCode1, $statusCode2): void {
|
||||||
$this->theHTTPStatusCodeShouldBe(
|
$this->theHTTPStatusCodeShouldBe(
|
||||||
[$statusCode1, $statusCode2]
|
[$statusCode1, $statusCode2],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1661,7 +1661,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
public function theHTTPStatusCodeShouldBeBetween(
|
public function theHTTPStatusCodeShouldBeBetween(
|
||||||
$minStatusCode,
|
$minStatusCode,
|
||||||
$maxStatusCode,
|
$maxStatusCode,
|
||||||
?ResponseInterface $response = null
|
?ResponseInterface $response = null,
|
||||||
): void {
|
): void {
|
||||||
$response = $response ?? $this->response;
|
$response = $response ?? $this->response;
|
||||||
$statusCode = $response->getStatusCode();
|
$statusCode = $response->getStatusCode();
|
||||||
@@ -1669,12 +1669,12 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
Assert::assertGreaterThanOrEqual(
|
Assert::assertGreaterThanOrEqual(
|
||||||
$minStatusCode,
|
$minStatusCode,
|
||||||
$statusCode,
|
$statusCode,
|
||||||
$message
|
$message,
|
||||||
);
|
);
|
||||||
Assert::assertLessThanOrEqual(
|
Assert::assertLessThanOrEqual(
|
||||||
$maxStatusCode,
|
$maxStatusCode,
|
||||||
$statusCode,
|
$statusCode,
|
||||||
$message
|
$message,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1692,7 +1692,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
Assert::assertGreaterThanOrEqual(
|
Assert::assertGreaterThanOrEqual(
|
||||||
400,
|
400,
|
||||||
$statusCode,
|
$statusCode,
|
||||||
$message
|
$message,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1743,7 +1743,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
$dirPathFromServerRoot,
|
$dirPathFromServerRoot,
|
||||||
$this->getBaseUrl(),
|
$this->getBaseUrl(),
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword()
|
$this->getAdminPassword(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2027,7 +2027,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
$this->getAdminPassword(),
|
$this->getAdminPassword(),
|
||||||
$this->guzzleClientHeaders,
|
$this->guzzleClientHeaders,
|
||||||
null,
|
null,
|
||||||
$config
|
$config,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2042,7 +2042,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
}
|
}
|
||||||
return \json_decode(
|
return \json_decode(
|
||||||
(string)$response->getBody(),
|
(string)$response->getBody(),
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2052,7 +2052,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
*/
|
*/
|
||||||
public function getJsonDecodedStatusPhp(): array {
|
public function getJsonDecodedStatusPhp(): array {
|
||||||
return $this->getJsonDecodedResponse(
|
return $this->getJsonDecodedResponse(
|
||||||
$this->getStatusPhp()
|
$this->getStatusPhp(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2149,7 +2149,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
?array $functions = [],
|
?array $functions = [],
|
||||||
?array $additionalSubstitutions = [],
|
?array $additionalSubstitutions = [],
|
||||||
?string $group = null,
|
?string $group = null,
|
||||||
?string $userName = null
|
?string $userName = null,
|
||||||
): ?string {
|
): ?string {
|
||||||
$substitutions = [
|
$substitutions = [
|
||||||
[
|
[
|
||||||
@@ -2540,7 +2540,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
"function" =>
|
"function" =>
|
||||||
[$this, "getGroupIdByGroupName"],
|
[$this, "getGroupIdByGroupName"],
|
||||||
"parameter" => [$group],
|
"parameter" => [$group],
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!OcisHelper::isTestingOnReva()) {
|
if (!OcisHelper::isTestingOnReva()) {
|
||||||
@@ -2553,7 +2553,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
"getSpaceIdByName",
|
"getSpaceIdByName",
|
||||||
],
|
],
|
||||||
"parameter" => [$user, "Shares"],
|
"parameter" => [$user, "Shares"],
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2569,7 +2569,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
|
|
||||||
$replacement = \call_user_func_array(
|
$replacement = \call_user_func_array(
|
||||||
$substitution["function"],
|
$substitution["function"],
|
||||||
$substitution["parameter"]
|
$substitution["parameter"],
|
||||||
);
|
);
|
||||||
|
|
||||||
// do not run functions on regex patterns
|
// do not run functions on regex patterns
|
||||||
@@ -2577,14 +2577,14 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
foreach ($functions as $function => $parameters) {
|
foreach ($functions as $function => $parameters) {
|
||||||
$replacement = \call_user_func_array(
|
$replacement = \call_user_func_array(
|
||||||
$function,
|
$function,
|
||||||
\array_merge([$replacement], $parameters)
|
\array_merge([$replacement], $parameters),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$value = \str_replace(
|
$value = \str_replace(
|
||||||
$substitution["code"],
|
$substitution["code"],
|
||||||
$replacement,
|
$replacement,
|
||||||
$value
|
$value,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
@@ -2700,7 +2700,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
if ($this->adminPassword !== $this->originalAdminPassword) {
|
if ($this->adminPassword !== $this->originalAdminPassword) {
|
||||||
$this->resetUserPasswordAsAdminUsingTheProvisioningApi(
|
$this->resetUserPasswordAsAdminUsingTheProvisioningApi(
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->originalAdminPassword
|
$this->originalAdminPassword,
|
||||||
);
|
);
|
||||||
$this->adminPassword = $this->originalAdminPassword;
|
$this->adminPassword = $this->originalAdminPassword;
|
||||||
}
|
}
|
||||||
@@ -2725,7 +2725,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
*/
|
*/
|
||||||
public function makeTemporaryStorageOnServerBefore(): void {
|
public function makeTemporaryStorageOnServerBefore(): void {
|
||||||
$this->mkDirOnServer(
|
$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 {
|
public function removeTemporaryStorageOnServerAfter(): void {
|
||||||
SetupHelper::rmDirOnServer(
|
SetupHelper::rmDirOnServer(
|
||||||
TEMPORARY_STORAGE_DIR_ON_REMOTE_SERVER,
|
TEMPORARY_STORAGE_DIR_ON_REMOTE_SERVER,
|
||||||
HttpRequestHelper::getCurrentScenarioRef()
|
HttpRequestHelper::getCurrentScenarioRef(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2780,7 +2780,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
public function verifyTableNodeColumns(
|
public function verifyTableNodeColumns(
|
||||||
?TableNode $table,
|
?TableNode $table,
|
||||||
?array $requiredHeader = [],
|
?array $requiredHeader = [],
|
||||||
?array $allowedHeader = []
|
?array $allowedHeader = [],
|
||||||
): void {
|
): void {
|
||||||
if ($table === null || \count($table->getHash()) < 1) {
|
if ($table === null || \count($table->getHash()) < 1) {
|
||||||
throw new Exception("Table should have at least one row.");
|
throw new Exception("Table should have at least one row.");
|
||||||
@@ -2897,7 +2897,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
$this->getBaseUrl(),
|
$this->getBaseUrl(),
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword(),
|
$this->getAdminPassword(),
|
||||||
$userName
|
$userName,
|
||||||
);
|
);
|
||||||
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
|
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
|
||||||
if (isset($data["id"])) {
|
if (isset($data["id"])) {
|
||||||
@@ -2919,7 +2919,7 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
$this->getBaseUrl(),
|
$this->getBaseUrl(),
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword(),
|
$this->getAdminPassword(),
|
||||||
$groupName
|
$groupName,
|
||||||
);
|
);
|
||||||
$data = $this->getJsonDecodedResponse($response);
|
$data = $this->getJsonDecodedResponse($response);
|
||||||
if (isset($data["id"])) {
|
if (isset($data["id"])) {
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class FilesVersionsContext implements Context {
|
|||||||
public function thePublicTriesToGetTheNumberOfVersionsOfFileWithPasswordUsingFileId(
|
public function thePublicTriesToGetTheNumberOfVersionsOfFileWithPasswordUsingFileId(
|
||||||
string $file,
|
string $file,
|
||||||
string $password,
|
string $password,
|
||||||
string $fileId
|
string $fileId,
|
||||||
): void {
|
): void {
|
||||||
$password = $this->featureContext->getActualPassword($password);
|
$password = $this->featureContext->getActualPassword($password);
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
@@ -109,8 +109,8 @@ class FilesVersionsContext implements Context {
|
|||||||
"versions",
|
"versions",
|
||||||
$this->featureContext->getDavPathVersion(),
|
$this->featureContext->getDavPathVersion(),
|
||||||
false,
|
false,
|
||||||
$password
|
$password,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ class FilesVersionsContext implements Context {
|
|||||||
Assert::assertNotNull(
|
Assert::assertNotNull(
|
||||||
$fileId,
|
$fileId,
|
||||||
__METHOD__
|
__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(
|
return $this->featureContext->makeDavRequest(
|
||||||
$user,
|
$user,
|
||||||
@@ -145,7 +145,7 @@ class FilesVersionsContext implements Context {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
$spaceId,
|
$spaceId,
|
||||||
"versions"
|
"versions",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,8 +167,8 @@ class FilesVersionsContext implements Context {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
"versions"
|
"versions",
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ class FilesVersionsContext implements Context {
|
|||||||
Assert::assertNotNull(
|
Assert::assertNotNull(
|
||||||
$fileId,
|
$fileId,
|
||||||
__METHOD__
|
__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"?>
|
$body = '<?xml version="1.0"?>
|
||||||
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
|
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
|
||||||
@@ -232,12 +232,12 @@ class FilesVersionsContext implements Context {
|
|||||||
Assert::assertNotNull(
|
Assert::assertNotNull(
|
||||||
$fileId,
|
$fileId,
|
||||||
__METHOD__
|
__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);
|
$response = $this->listVersionFolder($user, $fileId, 1);
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$response,
|
$response,
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$xmlPart = $responseXmlObject->xpath("//d:response/d:href");
|
$xmlPart = $responseXmlObject->xpath("//d:response/d:href");
|
||||||
// restoring the version only works with DAV path v2
|
// restoring the version only works with DAV path v2
|
||||||
@@ -250,7 +250,7 @@ class FilesVersionsContext implements Context {
|
|||||||
'COPY',
|
'COPY',
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
['Destination' => $destinationUrl]
|
['Destination' => $destinationUrl],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ class FilesVersionsContext implements Context {
|
|||||||
$response = $this->listVersionFolder($user, $fileId, 1);
|
$response = $this->listVersionFolder($user, $fileId, 1);
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$response,
|
$response,
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$actualCount = \count($responseXmlObject->xpath("//d:prop/d:getetag")) - 1;
|
$actualCount = \count($responseXmlObject->xpath("//d:prop/d:getetag")) - 1;
|
||||||
if ($actualCount === -1) {
|
if ($actualCount === -1) {
|
||||||
@@ -307,7 +307,7 @@ class FilesVersionsContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$expectedCount,
|
$expectedCount,
|
||||||
$actualCount,
|
$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(
|
public function theVersionFolderOfFileShouldContainElements(
|
||||||
string $path,
|
string $path,
|
||||||
string $user,
|
string $user,
|
||||||
int $count
|
int $count,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||||
Assert::assertNotNull(
|
Assert::assertNotNull(
|
||||||
$fileId,
|
$fileId,
|
||||||
__METHOD__
|
__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);
|
$this->assertFileVersionsCount($user, $fileId, $count);
|
||||||
}
|
}
|
||||||
@@ -349,7 +349,7 @@ class FilesVersionsContext implements Context {
|
|||||||
public function theVersionFolderOfFileIdShouldContainElements(
|
public function theVersionFolderOfFileIdShouldContainElements(
|
||||||
string $fileId,
|
string $fileId,
|
||||||
string $user,
|
string $user,
|
||||||
int $count
|
int $count,
|
||||||
): void {
|
): void {
|
||||||
$this->assertFileVersionsCount($user, $fileId, $count);
|
$this->assertFileVersionsCount($user, $fileId, $count);
|
||||||
}
|
}
|
||||||
@@ -369,26 +369,26 @@ class FilesVersionsContext implements Context {
|
|||||||
string $path,
|
string $path,
|
||||||
int $index,
|
int $index,
|
||||||
string $user,
|
string $user,
|
||||||
int $length
|
int $length,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
$fileId = $this->featureContext->getFileIdForPath($user, $path);
|
||||||
Assert::assertNotNull(
|
Assert::assertNotNull(
|
||||||
$fileId,
|
$fileId,
|
||||||
__METHOD__
|
__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']);
|
$response = $this->listVersionFolder($user, $fileId, 1, ['d:getcontentlength']);
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$response,
|
$response,
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$xmlPart = $responseXmlObject->xpath("//d:prop/d:getcontentlength");
|
$xmlPart = $responseXmlObject->xpath("//d:prop/d:getcontentlength");
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$length,
|
$length,
|
||||||
(int) $xmlPart[$index],
|
(int) $xmlPart[$index],
|
||||||
"The content length of file $path with version $index for user $user was
|
"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(
|
public function asUsersAuthorsOfVersionsOfFileShouldBe(
|
||||||
string $users,
|
string $users,
|
||||||
string $filename,
|
string $filename,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->verifyTableNodeColumns(
|
$this->featureContext->verifyTableNodeColumns(
|
||||||
$table,
|
$table,
|
||||||
['index', 'author']
|
['index', 'author'],
|
||||||
);
|
);
|
||||||
$requiredVersionMetadata = $table->getHash();
|
$requiredVersionMetadata = $table->getHash();
|
||||||
$usersArray = \explode(",", $users);
|
$usersArray = \explode(",", $users);
|
||||||
foreach ($usersArray as $username) {
|
foreach ($usersArray as $username) {
|
||||||
$actualUsername = $this->featureContext->getActualUsername($username);
|
$actualUsername = $this->featureContext->getActualUsername($username);
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->getFileVersionMetadata($actualUsername, $filename)
|
$this->getFileVersionMetadata($actualUsername, $filename),
|
||||||
);
|
);
|
||||||
foreach ($requiredVersionMetadata as $versionMetadata) {
|
foreach ($requiredVersionMetadata as $versionMetadata) {
|
||||||
$this->featureContext->checkAuthorOfAVersionOfFile(
|
$this->featureContext->checkAuthorOfAVersionOfFile(
|
||||||
$versionMetadata['index'],
|
$versionMetadata['index'],
|
||||||
$versionMetadata['author']
|
$versionMetadata['author'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -440,14 +440,14 @@ class FilesVersionsContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $path,
|
string $path,
|
||||||
string $index,
|
string $index,
|
||||||
?string $spaceId = null
|
?string $spaceId = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$fileId = $this->featureContext->getFileIdForPath($user, $path, $spaceId);
|
$fileId = $this->featureContext->getFileIdForPath($user, $path, $spaceId);
|
||||||
Assert::assertNotNull(
|
Assert::assertNotNull(
|
||||||
$fileId,
|
$fileId,
|
||||||
__METHOD__
|
__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;
|
$index = (int)$index;
|
||||||
$response = $this->listVersionFolder($user, $fileId, 1);
|
$response = $this->listVersionFolder($user, $fileId, 1);
|
||||||
@@ -458,17 +458,17 @@ class FilesVersionsContext implements Context {
|
|||||||
$xmlPart = $responseXmlObject->xpath("//d:response/d:href");
|
$xmlPart = $responseXmlObject->xpath("//d:response/d:href");
|
||||||
if (!isset($xmlPart[$index])) {
|
if (!isset($xmlPart[$index])) {
|
||||||
Assert::fail(
|
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
|
// the href already contains the path
|
||||||
$url = WebDavHelper::sanitizeUrl(
|
$url = WebDavHelper::sanitizeUrl(
|
||||||
$this->featureContext->getBaseUrlWithoutPath() . $xmlPart[$index]
|
$this->featureContext->getBaseUrlWithoutPath() . $xmlPart[$index],
|
||||||
);
|
);
|
||||||
return HttpRequestHelper::get(
|
return HttpRequestHelper::get(
|
||||||
$url,
|
$url,
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user)
|
$this->featureContext->getPasswordForUser($user),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,7 +501,7 @@ class FilesVersionsContext implements Context {
|
|||||||
string $index,
|
string $index,
|
||||||
string $path,
|
string $path,
|
||||||
string $user,
|
string $user,
|
||||||
string $content
|
string $content,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadVersion($user, $path, $index);
|
$response = $this->downloadVersion($user, $path, $index);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe("200", '', $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe("200", '', $response);
|
||||||
@@ -546,7 +546,7 @@ class FilesVersionsContext implements Context {
|
|||||||
null,
|
null,
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->getDavPathVersion(),
|
$this->featureContext->getDavPathVersion(),
|
||||||
null
|
null,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -567,7 +567,7 @@ class FilesVersionsContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $fileId,
|
string $fileId,
|
||||||
int $folderDepth,
|
int $folderDepth,
|
||||||
?array $properties = null
|
?array $properties = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
if (!$properties) {
|
if (!$properties) {
|
||||||
$properties = [
|
$properties = [
|
||||||
@@ -584,7 +584,7 @@ class FilesVersionsContext implements Context {
|
|||||||
$properties,
|
$properties,
|
||||||
(string) $folderDepth,
|
(string) $folderDepth,
|
||||||
null,
|
null,
|
||||||
"versions"
|
"versions",
|
||||||
);
|
);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@@ -609,8 +609,8 @@ class FilesVersionsContext implements Context {
|
|||||||
null,
|
null,
|
||||||
null,
|
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(),
|
$this->featureContext->getAdminPassword(),
|
||||||
'DELETE',
|
'DELETE',
|
||||||
$this->globalNotificationEndpointPath,
|
$this->globalNotificationEndpointPath,
|
||||||
json_encode($payload)
|
json_encode($payload),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ class NotificationContext implements Context {
|
|||||||
$this->notificationEndpointPath,
|
$this->notificationEndpointPath,
|
||||||
[],
|
[],
|
||||||
2,
|
2,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ class NotificationContext implements Context {
|
|||||||
'DELETE',
|
'DELETE',
|
||||||
$this->notificationEndpointPath,
|
$this->notificationEndpointPath,
|
||||||
\json_encode($payload),
|
\json_encode($payload),
|
||||||
2
|
2,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ class NotificationContext implements Context {
|
|||||||
$response = $this->featureContext->getResponse()->getBody()->getContents();
|
$response = $this->featureContext->getResponse()->getBody()->getContents();
|
||||||
throw new \Exception(
|
throw new \Exception(
|
||||||
__METHOD__
|
__METHOD__
|
||||||
. " Failed to get user notification list" . $response
|
. " Failed to get user notification list" . $response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$notifications = $this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data;
|
$notifications = $this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data;
|
||||||
@@ -272,7 +272,7 @@ class NotificationContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$numberOfNotification,
|
$numberOfNotification,
|
||||||
$actualNumber,
|
$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(
|
public function theJsonDataFromLastResponseShouldMatch(
|
||||||
string $subject,
|
string $subject,
|
||||||
PyStringNode $schemaString
|
PyStringNode $schemaString,
|
||||||
): void {
|
): void {
|
||||||
$responseBody = $this->filterResponseAccordingToNotificationSubject($subject);
|
$responseBody = $this->filterResponseAccordingToNotificationSubject($subject);
|
||||||
// substitute the value here
|
// substitute the value here
|
||||||
@@ -302,7 +302,7 @@ class NotificationContext implements Context {
|
|||||||
);
|
);
|
||||||
$this->featureContext->assertJsonDocumentMatchesSchema(
|
$this->featureContext->assertJsonDocumentMatchesSchema(
|
||||||
$responseBody,
|
$responseBody,
|
||||||
$this->featureContext->getJSONSchema($schemaString)
|
$this->featureContext->getJSONSchema($schemaString),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ class NotificationContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function filterResponseAccordingToNotificationSubject(
|
public function filterResponseAccordingToNotificationSubject(
|
||||||
string $subject,
|
string $subject,
|
||||||
?ResponseInterface $response = null
|
?ResponseInterface $response = null,
|
||||||
): object {
|
): object {
|
||||||
$response = $response ?? $this->featureContext->getResponse();
|
$response = $response ?? $this->featureContext->getResponse();
|
||||||
if (isset($this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data)) {
|
if (isset($this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data)) {
|
||||||
@@ -344,7 +344,7 @@ class NotificationContext implements Context {
|
|||||||
public function filterNotificationsBySubjectAndResource(
|
public function filterNotificationsBySubjectAndResource(
|
||||||
string $subject,
|
string $subject,
|
||||||
string $resource,
|
string $resource,
|
||||||
?ResponseInterface $response = null
|
?ResponseInterface $response = null,
|
||||||
): array {
|
): array {
|
||||||
$filteredNotifications = [];
|
$filteredNotifications = [];
|
||||||
$response = $response ?? $this->featureContext->getResponse();
|
$response = $response ?? $this->featureContext->getResponse();
|
||||||
@@ -379,7 +379,7 @@ class NotificationContext implements Context {
|
|||||||
public function filterNotificationsBySubjectAndSpace(
|
public function filterNotificationsBySubjectAndSpace(
|
||||||
string $subject,
|
string $subject,
|
||||||
string $space,
|
string $space,
|
||||||
?ResponseInterface $response = null
|
?ResponseInterface $response = null,
|
||||||
): array {
|
): array {
|
||||||
$filteredNotifications = [];
|
$filteredNotifications = [];
|
||||||
$response = $response ?? $this->featureContext->getResponse();
|
$response = $response ?? $this->featureContext->getResponse();
|
||||||
@@ -430,7 +430,7 @@ class NotificationContext implements Context {
|
|||||||
$actualMessage = str_replace(
|
$actualMessage = str_replace(
|
||||||
["\r", "\n"],
|
["\r", "\n"],
|
||||||
" ",
|
" ",
|
||||||
$this->filterResponseAccordingToNotificationSubject($subject, $response)->message
|
$this->filterResponseAccordingToNotificationSubject($subject, $response)->message,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception("Notification was not found even after retrying for 5 seconds.");
|
throw new \Exception("Notification was not found even after retrying for 5 seconds.");
|
||||||
@@ -439,7 +439,7 @@ class NotificationContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$expectedMessage,
|
$expectedMessage,
|
||||||
$actualMessage,
|
$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 $user,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $subject,
|
string $subject,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->listAllNotifications($user);
|
$response = $this->listAllNotifications($user);
|
||||||
$notification = $this->filterNotificationsBySubjectAndResource($subject, $resource, $response);
|
$notification = $this->filterNotificationsBySubjectAndResource($subject, $resource, $response);
|
||||||
@@ -469,19 +469,19 @@ class NotificationContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$expectedMessage,
|
$expectedMessage,
|
||||||
$actualMessage,
|
$actualMessage,
|
||||||
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'"
|
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'",
|
||||||
);
|
);
|
||||||
$response = $this->userDeletesNotification($user);
|
$response = $this->userDeletesNotification($user);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||||
} elseif (\count($notification) === 0) {
|
} elseif (\count($notification) === 0) {
|
||||||
throw new \Exception(
|
throw new \Exception(
|
||||||
"Response doesn't contain any notification with resource '$resource' and subject '$subject'.\n"
|
"Response doesn't contain any notification with resource '$resource' and subject '$subject'.\n"
|
||||||
. print_r($notification, true)
|
. print_r($notification, true),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception(
|
throw new \Exception(
|
||||||
"Response contains more than one notification with resource '$resource' and subject '$subject'.\n"
|
"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 $user,
|
||||||
string $resourceOrSpace,
|
string $resourceOrSpace,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $subject
|
string $subject,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->listAllNotifications($user);
|
$response = $this->listAllNotifications($user);
|
||||||
if ($resourceOrSpace === "space") {
|
if ($resourceOrSpace === "space") {
|
||||||
@@ -512,7 +512,7 @@ class NotificationContext implements Context {
|
|||||||
0,
|
0,
|
||||||
$filteredResponse,
|
$filteredResponse,
|
||||||
"Response should not contain notification related to resource '$resource' with subject '$subject' but found"
|
"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(
|
public function userCreatesDeprovisioningNotification(
|
||||||
?string $user = null,
|
?string $user = null,
|
||||||
?string $deprovision_date = "2043-07-04T11:23:12Z",
|
?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 {
|
): ResponseInterface {
|
||||||
$payload["type"] = "deprovision";
|
$payload["type"] = "deprovision";
|
||||||
$payload["data"] = [
|
$payload["data"] = [
|
||||||
@@ -542,7 +542,7 @@ class NotificationContext implements Context {
|
|||||||
$user ? $this->featureContext->getPasswordForUser($user) : $this->featureContext->getAdminPassword(),
|
$user ? $this->featureContext->getPasswordForUser($user) : $this->featureContext->getAdminPassword(),
|
||||||
'POST',
|
'POST',
|
||||||
$this->globalNotificationEndpointPath,
|
$this->globalNotificationEndpointPath,
|
||||||
json_encode($payload)
|
json_encode($payload),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,7 +576,7 @@ class NotificationContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theAdministratorCreatesADeprovisioningNotificationUsingDateFormat(
|
public function theAdministratorCreatesADeprovisioningNotificationUsingDateFormat(
|
||||||
$deprovision_date,
|
$deprovision_date,
|
||||||
$deprovision_date_format
|
$deprovision_date_format,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->userCreatesDeprovisioningNotification(null, $deprovision_date, $deprovision_date_format);
|
$response = $this->userCreatesDeprovisioningNotification(null, $deprovision_date, $deprovision_date_format);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -610,7 +610,7 @@ class NotificationContext implements Context {
|
|||||||
$user ? $this->featureContext->getPasswordForUser($user) : $this->featureContext->getAdminPassword(),
|
$user ? $this->featureContext->getPasswordForUser($user) : $this->featureContext->getAdminPassword(),
|
||||||
'DELETE',
|
'DELETE',
|
||||||
$this->globalNotificationEndpointPath,
|
$this->globalNotificationEndpointPath,
|
||||||
json_encode($payload)
|
json_encode($payload),
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class OCSContext implements Context {
|
|||||||
$verb,
|
$verb,
|
||||||
$url,
|
$url,
|
||||||
null,
|
null,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ class OCSContext implements Context {
|
|||||||
string $url,
|
string $url,
|
||||||
?TableNode $body = null,
|
?TableNode $body = null,
|
||||||
?string $password = null,
|
?string $password = null,
|
||||||
?array $headers = null
|
?array $headers = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
/**
|
/**
|
||||||
* array of the data to be sent in the body.
|
* array of the data to be sent in the body.
|
||||||
@@ -118,7 +118,7 @@ class OCSContext implements Context {
|
|||||||
$url,
|
$url,
|
||||||
$bodyArray,
|
$bodyArray,
|
||||||
$this->featureContext->getOcsApiVersion(),
|
$this->featureContext->getOcsApiVersion(),
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,14 +132,14 @@ class OCSContext implements Context {
|
|||||||
public function adminSendsHttpMethodToOcsApiEndpointWithBody(
|
public function adminSendsHttpMethodToOcsApiEndpointWithBody(
|
||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
?TableNode $body
|
?TableNode $body,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$admin = $this->featureContext->getAdminUsername();
|
$admin = $this->featureContext->getAdminUsername();
|
||||||
return $this->sendRequestToOcsEndpoint(
|
return $this->sendRequestToOcsEndpoint(
|
||||||
$admin,
|
$admin,
|
||||||
$verb,
|
$verb,
|
||||||
$url,
|
$url,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,13 +153,13 @@ class OCSContext implements Context {
|
|||||||
public function theUserSendsToOcsApiEndpointWithBody(
|
public function theUserSendsToOcsApiEndpointWithBody(
|
||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
?TableNode $body = null
|
?TableNode $body = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
return $this->sendRequestToOcsEndpoint(
|
return $this->sendRequestToOcsEndpoint(
|
||||||
$this->featureContext->getCurrentUser(),
|
$this->featureContext->getCurrentUser(),
|
||||||
$verb,
|
$verb,
|
||||||
$url,
|
$url,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,14 +179,14 @@ class OCSContext implements Context {
|
|||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
?TableNode $body = null,
|
?TableNode $body = null,
|
||||||
?string $password = null
|
?string $password = null,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->sendRequestToOcsEndpoint(
|
$response = $this->sendRequestToOcsEndpoint(
|
||||||
$user,
|
$user,
|
||||||
$verb,
|
$verb,
|
||||||
$url,
|
$url,
|
||||||
$body,
|
$body,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ class OCSContext implements Context {
|
|||||||
public function theAdministratorSendsHttpMethodToOcsApiEndpoint(
|
public function theAdministratorSendsHttpMethodToOcsApiEndpoint(
|
||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
?string $password = null
|
?string $password = null,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->sendRequestToOcsEndpoint(
|
$this->sendRequestToOcsEndpoint(
|
||||||
@@ -212,8 +212,8 @@ class OCSContext implements Context {
|
|||||||
$verb,
|
$verb,
|
||||||
$url,
|
$url,
|
||||||
null,
|
null,
|
||||||
$password
|
$password,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ class OCSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
TableNode $headersTable
|
TableNode $headersTable,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$password = $this->featureContext->getPasswordForUser($user);
|
$password = $this->featureContext->getPasswordForUser($user);
|
||||||
@@ -243,8 +243,8 @@ class OCSContext implements Context {
|
|||||||
$url,
|
$url,
|
||||||
null,
|
null,
|
||||||
$password,
|
$password,
|
||||||
$headersTable->getRowsHash()
|
$headersTable->getRowsHash(),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ class OCSContext implements Context {
|
|||||||
public function administratorSendsToOcsApiEndpointWithHeaders(
|
public function administratorSendsToOcsApiEndpointWithHeaders(
|
||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
TableNode $headersTable
|
TableNode $headersTable,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getAdminUsername();
|
$user = $this->featureContext->getAdminUsername();
|
||||||
$password = $this->featureContext->getPasswordForUser($user);
|
$password = $this->featureContext->getPasswordForUser($user);
|
||||||
@@ -272,8 +272,8 @@ class OCSContext implements Context {
|
|||||||
$url,
|
$url,
|
||||||
null,
|
null,
|
||||||
$password,
|
$password,
|
||||||
$headersTable->getRowsHash()
|
$headersTable->getRowsHash(),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ class OCSContext implements Context {
|
|||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
string $password,
|
string $password,
|
||||||
TableNode $headersTable
|
TableNode $headersTable,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->sendRequestToOcsEndpoint(
|
$this->sendRequestToOcsEndpoint(
|
||||||
@@ -301,8 +301,8 @@ class OCSContext implements Context {
|
|||||||
$url,
|
$url,
|
||||||
null,
|
null,
|
||||||
$password,
|
$password,
|
||||||
$headersTable->getRowsHash()
|
$headersTable->getRowsHash(),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,12 +318,12 @@ class OCSContext implements Context {
|
|||||||
public function theAdministratorSendsHttpMethodToOcsApiEndpointWithBody(
|
public function theAdministratorSendsHttpMethodToOcsApiEndpointWithBody(
|
||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
?TableNode $body
|
?TableNode $body,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->adminSendsHttpMethodToOcsApiEndpointWithBody(
|
$response = $this->adminSendsHttpMethodToOcsApiEndpointWithBody(
|
||||||
$verb,
|
$verb,
|
||||||
$url,
|
$url,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ class OCSContext implements Context {
|
|||||||
$response = $this->theUserSendsToOcsApiEndpointWithBody(
|
$response = $this->theUserSendsToOcsApiEndpointWithBody(
|
||||||
$verb,
|
$verb,
|
||||||
$url,
|
$url,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ class OCSContext implements Context {
|
|||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
string $password,
|
string $password,
|
||||||
TableNode $body
|
TableNode $body,
|
||||||
): void {
|
): void {
|
||||||
$admin = $this->featureContext->getAdminUsername();
|
$admin = $this->featureContext->getAdminUsername();
|
||||||
$response = $this->sendRequestToOcsEndpoint(
|
$response = $this->sendRequestToOcsEndpoint(
|
||||||
@@ -368,7 +368,7 @@ class OCSContext implements Context {
|
|||||||
$verb,
|
$verb,
|
||||||
$url,
|
$url,
|
||||||
$body,
|
$body,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -389,14 +389,14 @@ class OCSContext implements Context {
|
|||||||
string $verb,
|
string $verb,
|
||||||
string $url,
|
string $url,
|
||||||
string $password,
|
string $password,
|
||||||
TableNode $body
|
TableNode $body,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->sendRequestToOcsEndpoint(
|
$response = $this->sendRequestToOcsEndpoint(
|
||||||
$user,
|
$user,
|
||||||
$verb,
|
$verb,
|
||||||
$url,
|
$url,
|
||||||
$body,
|
$body,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -414,12 +414,12 @@ class OCSContext implements Context {
|
|||||||
public function theOCSStatusCodeShouldBe(
|
public function theOCSStatusCodeShouldBe(
|
||||||
string $statusCode,
|
string $statusCode,
|
||||||
string $message = "",
|
string $message = "",
|
||||||
?ResponseInterface $response = null
|
?ResponseInterface $response = null,
|
||||||
): void {
|
): void {
|
||||||
$statusCodes = explode(",", $statusCode);
|
$statusCodes = explode(",", $statusCode);
|
||||||
$response = $response ?? $this->featureContext->getResponse();
|
$response = $response ?? $this->featureContext->getResponse();
|
||||||
$responseStatusCode = $this->getOCSResponseStatusCode(
|
$responseStatusCode = $this->getOCSResponseStatusCode(
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
if (\is_array($statusCodes)) {
|
if (\is_array($statusCodes)) {
|
||||||
if ($message === "") {
|
if ($message === "") {
|
||||||
@@ -429,7 +429,7 @@ class OCSContext implements Context {
|
|||||||
Assert::assertContainsEquals(
|
Assert::assertContainsEquals(
|
||||||
$responseStatusCode,
|
$responseStatusCode,
|
||||||
$statusCodes,
|
$statusCodes,
|
||||||
$message
|
$message,
|
||||||
);
|
);
|
||||||
$this->featureContext->emptyLastOCSStatusCodesArray();
|
$this->featureContext->emptyLastOCSStatusCodesArray();
|
||||||
} else {
|
} else {
|
||||||
@@ -440,7 +440,7 @@ class OCSContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$statusCodes,
|
$statusCodes,
|
||||||
$responseStatusCode,
|
$responseStatusCode,
|
||||||
$message
|
$message,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -458,13 +458,13 @@ class OCSContext implements Context {
|
|||||||
$statusCodes = [$statusCode1,$statusCode1];
|
$statusCodes = [$statusCode1,$statusCode1];
|
||||||
$response = $this->featureContext->getResponse();
|
$response = $this->featureContext->getResponse();
|
||||||
$responseStatusCode = $this->getOCSResponseStatusCode(
|
$responseStatusCode = $this->getOCSResponseStatusCode(
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
Assert::assertContainsEquals(
|
Assert::assertContainsEquals(
|
||||||
$responseStatusCode,
|
$responseStatusCode,
|
||||||
$statusCodes,
|
$statusCodes,
|
||||||
"OCS status code is not any of the expected values "
|
"OCS status code is not any of the expected values "
|
||||||
. \implode(",", $statusCodes) . " got " . $responseStatusCode
|
. \implode(",", $statusCodes) . " got " . $responseStatusCode,
|
||||||
);
|
);
|
||||||
$this->featureContext->emptyLastOCSStatusCodesArray();
|
$this->featureContext->emptyLastOCSStatusCodesArray();
|
||||||
}
|
}
|
||||||
@@ -487,11 +487,11 @@ class OCSContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$statusMessage,
|
$statusMessage,
|
||||||
$this->getOCSResponseStatusMessage(
|
$this->getOCSResponseStatusMessage(
|
||||||
$this->featureContext->getResponse()
|
$this->featureContext->getResponse(),
|
||||||
),
|
),
|
||||||
'Unexpected OCS status message :"' . $this->getOCSResponseStatusMessage(
|
'Unexpected OCS status message :"' . $this->getOCSResponseStatusMessage(
|
||||||
$this->featureContext->getResponse()
|
$this->featureContext->getResponse(),
|
||||||
) . '" in response'
|
) . '" in response',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,16 +509,16 @@ class OCSContext implements Context {
|
|||||||
$user = \strtolower($this->featureContext->getActualUsername($user));
|
$user = \strtolower($this->featureContext->getActualUsername($user));
|
||||||
$statusMessage = $this->featureContext->substituteInLineCodes(
|
$statusMessage = $this->featureContext->substituteInLineCodes(
|
||||||
$statusMessage,
|
$statusMessage,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$statusMessage,
|
$statusMessage,
|
||||||
$this->getOCSResponseStatusMessage(
|
$this->getOCSResponseStatusMessage(
|
||||||
$this->featureContext->getResponse()
|
$this->featureContext->getResponse(),
|
||||||
),
|
),
|
||||||
'Unexpected OCS status message :"' . $this->getOCSResponseStatusMessage(
|
'Unexpected OCS status message :"' . $this->getOCSResponseStatusMessage(
|
||||||
$this->featureContext->getResponse()
|
$this->featureContext->getResponse(),
|
||||||
) . '" in response'
|
) . '" in response',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,16 +541,16 @@ class OCSContext implements Context {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function theOCSStatusMessageShouldBePyString(
|
public function theOCSStatusMessageShouldBePyString(
|
||||||
PyStringNode $statusMessage
|
PyStringNode $statusMessage,
|
||||||
): void {
|
): void {
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$statusMessage->getRaw(),
|
$statusMessage->getRaw(),
|
||||||
$this->getOCSResponseStatusMessage(
|
$this->getOCSResponseStatusMessage(
|
||||||
$this->featureContext->getResponse()
|
$this->featureContext->getResponse(),
|
||||||
),
|
),
|
||||||
'Unexpected OCS status message: "' . $this->getOCSResponseStatusMessage(
|
'Unexpected OCS status message: "' . $this->getOCSResponseStatusMessage(
|
||||||
$this->featureContext->getResponse()
|
$this->featureContext->getResponse(),
|
||||||
) . '" in response'
|
) . '" in response',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,7 +621,7 @@ class OCSContext implements Context {
|
|||||||
if ($language !== null) {
|
if ($language !== null) {
|
||||||
$multiLingualMessage = \json_decode(
|
$multiLingualMessage = \json_decode(
|
||||||
\file_get_contents(__DIR__ . "/../fixtures/multiLanguageErrors.json"),
|
\file_get_contents(__DIR__ . "/../fixtures/multiLanguageErrors.json"),
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($multiLingualMessage[$statusMessage][$language])) {
|
if (isset($multiLingualMessage[$statusMessage][$language])) {
|
||||||
@@ -643,7 +643,7 @@ class OCSContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function assertOCSResponseIndicatesSuccess(
|
public function assertOCSResponseIndicatesSuccess(
|
||||||
?string $message = "",
|
?string $message = "",
|
||||||
?ResponseInterface $response = null
|
?ResponseInterface $response = null,
|
||||||
): void {
|
): void {
|
||||||
$response = $response ?? $this->featureContext->getResponse();
|
$response = $response ?? $this->featureContext->getResponse();
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe('200', $message, $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe('200', $message, $response);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class OcisConfigContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$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(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$response->getStatusCode(),
|
||||||
"Failed to set config $configVariable=$configValue"
|
"Failed to set config $configVariable=$configValue",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ class OcisConfigContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$response->getStatusCode(),
|
||||||
"Failed to enable role $role"
|
"Failed to enable role $role",
|
||||||
);
|
);
|
||||||
$this->setEnabledPermissionsRoles($defaultRoles);
|
$this->setEnabledPermissionsRoles($defaultRoles);
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ class OcisConfigContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$response->getStatusCode(),
|
||||||
"Failed to disable role $role"
|
"Failed to disable role $role",
|
||||||
);
|
);
|
||||||
$this->setEnabledPermissionsRoles($availableRoles);
|
$this->setEnabledPermissionsRoles($availableRoles);
|
||||||
}
|
}
|
||||||
@@ -160,12 +160,12 @@ class OcisConfigContext implements Context {
|
|||||||
$response = OcisConfigHelper::reConfigureOcis(
|
$response = OcisConfigHelper::reConfigureOcis(
|
||||||
[
|
[
|
||||||
$configVariable => $path,
|
$configVariable => $path,
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$response->getStatusCode(),
|
||||||
"Failed to set config $configVariable=$path"
|
"Failed to set config $configVariable=$path",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ class OcisConfigContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$response->getStatusCode(),
|
||||||
"Failed to set config"
|
"Failed to set config",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ class OcisConfigContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theAdministratorHasStartedServiceSeparatelyWithTheFollowingConfig(
|
public function theAdministratorHasStartedServiceSeparatelyWithTheFollowingConfig(
|
||||||
string $service,
|
string $service,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$envs = [];
|
$envs = [];
|
||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
@@ -213,7 +213,7 @@ class OcisConfigContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$response->getStatusCode(),
|
||||||
"Failed to start service $service."
|
"Failed to start service $service.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ class OcisConfigContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$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(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode(),
|
$response->getStatusCode(),
|
||||||
"Failed to rollback services."
|
"Failed to rollback services.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class OcmContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$email,
|
$email,
|
||||||
$description
|
$description,
|
||||||
);
|
);
|
||||||
$responseData = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
|
$responseData = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
|
||||||
if (isset($responseData["token"])) {
|
if (isset($responseData["token"])) {
|
||||||
@@ -142,7 +142,7 @@ class OcmContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$token ? $token : $this->getLastFederatedInvitationToken(),
|
$token ? $token : $this->getLastFederatedInvitationToken(),
|
||||||
$providerDomain
|
$providerDomain,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,8 +201,8 @@ class OcmContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$token,
|
$token,
|
||||||
$providerDomain
|
$providerDomain,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ class OcmContext implements Context {
|
|||||||
$response = OcmHelper::findAcceptedUsers(
|
$response = OcmHelper::findAcceptedUsers(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user)
|
$this->featureContext->getPasswordForUser($user),
|
||||||
);
|
);
|
||||||
if ($response->getStatusCode() === 200) {
|
if ($response->getStatusCode() === 200) {
|
||||||
$users = $this->featureContext->getJsonDecodedResponse($response);
|
$users = $this->featureContext->getJsonDecodedResponse($response);
|
||||||
@@ -261,7 +261,7 @@ class OcmContext implements Context {
|
|||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
200,
|
200,
|
||||||
"failed to list accepted users by '$user'",
|
"failed to list accepted users by '$user'",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
$users = ($this->featureContext->getJsonDecodedResponse($response));
|
$users = ($this->featureContext->getJsonDecodedResponse($response));
|
||||||
foreach ($users as $acceptedUser) {
|
foreach ($users as $acceptedUser) {
|
||||||
@@ -282,7 +282,7 @@ class OcmContext implements Context {
|
|||||||
return OcmHelper::listInvite(
|
return OcmHelper::listInvite(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user)
|
$this->featureContext->getPasswordForUser($user),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ class OcmContext implements Context {
|
|||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
200,
|
200,
|
||||||
"failed while deleting connection with user $ocmUser",
|
"failed while deleting connection with user $ocmUser",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ class OcmContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$ocmUser['user_id'],
|
$ocmUser['user_id'],
|
||||||
$ocmUser['idp']
|
$ocmUser['idp'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,12 +395,12 @@ class OcmContext implements Context {
|
|||||||
$response = HttpRequestHelper::get(
|
$response = HttpRequestHelper::get(
|
||||||
$this->archiverContext->getArchiverUrl($queryString),
|
$this->archiverContext->getArchiverUrl($queryString),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user)
|
$this->featureContext->getPasswordForUser($user),
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
200,
|
200,
|
||||||
"Failed to download archive of resource $resource",
|
"Failed to download archive of resource $resource",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,7 +418,7 @@ class OcmContext implements Context {
|
|||||||
public function userSendsPropfindRequestToFederatedShareWithDepthUsingTheWebdavApi(
|
public function userSendsPropfindRequestToFederatedShareWithDepthUsingTheWebdavApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $share,
|
string $share,
|
||||||
string $folderDepth
|
string $folderDepth,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->spacesContext->sendPropfindRequestToSpace($user, "", $share, null, $folderDepth, true);
|
$response = $this->spacesContext->sendPropfindRequestToSpace($user, "", $share, null, $folderDepth, true);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -462,7 +462,7 @@ class OcmContext implements Context {
|
|||||||
public function userDeletesFederatedConnectionWithUserAndProviderUsingTheGraphApi(
|
public function userDeletesFederatedConnectionWithUserAndProviderUsingTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $ocmUser,
|
string $ocmUser,
|
||||||
string $idp
|
string $idp,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse($this->deleteConnection($user, $ocmUser, $idp));
|
$this->featureContext->setResponse($this->deleteConnection($user, $ocmUser, $idp));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ trait Provisioning {
|
|||||||
return $usersList[$normalizedUsername][$attribute];
|
return $usersList[$normalizedUsername][$attribute];
|
||||||
}
|
}
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
__METHOD__ . ": User '$user' has no attribute with name '$attribute'."
|
__METHOD__ . ": User '$user' has no attribute with name '$attribute'.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -139,7 +139,7 @@ trait Provisioning {
|
|||||||
return $groupsList[$group][$attribute];
|
return $groupsList[$group][$attribute];
|
||||||
}
|
}
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
__METHOD__ . ": Group '$group' has no attribute with name '$attribute'."
|
__METHOD__ . ": Group '$group' has no attribute with name '$attribute'.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -160,7 +160,7 @@ trait Provisioning {
|
|||||||
$password = $this->createdUsers[$normalizedUsername]['password'];
|
$password = $this->createdUsers[$normalizedUsername]['password'];
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(
|
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
|
* @throws Exception|GuzzleException
|
||||||
*/
|
*/
|
||||||
public function userHasBeenCreatedWithDefaultAttributes(
|
public function userHasBeenCreatedWithDefaultAttributes(
|
||||||
string $user
|
string $user,
|
||||||
): void {
|
): void {
|
||||||
$this->userHasBeenCreated(["userName" => $user]);
|
$this->userHasBeenCreated(["userName" => $user]);
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ trait Provisioning {
|
|||||||
* @throws Exception|GuzzleException
|
* @throws Exception|GuzzleException
|
||||||
*/
|
*/
|
||||||
public function userHasBeenCreatedWithDefaultAttributesAndNotInitialized(
|
public function userHasBeenCreatedWithDefaultAttributesAndNotInitialized(
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$this->usersHaveBeenCreated($table, true, false);
|
$this->usersHaveBeenCreated($table, true, false);
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ trait Provisioning {
|
|||||||
$rows = $table->getRowsHash();
|
$rows = $table->getRowsHash();
|
||||||
$this->userHasBeenCreated(
|
$this->userHasBeenCreated(
|
||||||
$rows,
|
$rows,
|
||||||
$byUser
|
$byUser,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ trait Provisioning {
|
|||||||
|
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
__METHOD__
|
__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(
|
"uid=" . ldap_escape(
|
||||||
$entry['uid'],
|
$entry['uid'],
|
||||||
"",
|
"",
|
||||||
LDAP_ESCAPE_DN
|
LDAP_ESCAPE_DN,
|
||||||
) . ",ou=" . $this->ldapUsersOU . "," . $this->ldapBaseDN,
|
) . ",ou=" . $this->ldapUsersOU . "," . $this->ldapBaseDN,
|
||||||
);
|
);
|
||||||
OcisHelper::deleteRevaUserData([$entry['uid']]);
|
OcisHelper::deleteRevaUserData([$entry['uid']]);
|
||||||
@@ -514,12 +514,12 @@ trait Provisioning {
|
|||||||
// delete all created ldap users
|
// delete all created ldap users
|
||||||
$this->ldap->delete(
|
$this->ldap->delete(
|
||||||
"ou=" . $this->ldapUsersOU . "," . $this->ldapBaseDN,
|
"ou=" . $this->ldapUsersOU . "," . $this->ldapBaseDN,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
// delete all created ldap groups
|
// delete all created ldap groups
|
||||||
$this->ldap->delete(
|
$this->ldap->delete(
|
||||||
"ou=" . $this->ldapGroupsOU . "," . $this->ldapBaseDN,
|
"ou=" . $this->ldapGroupsOU . "," . $this->ldapBaseDN,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -541,7 +541,7 @@ trait Provisioning {
|
|||||||
public function usersHaveBeenCreated(
|
public function usersHaveBeenCreated(
|
||||||
TableNode $table,
|
TableNode $table,
|
||||||
bool $useDefault = true,
|
bool $useDefault = true,
|
||||||
bool $initialize = true
|
bool $initialize = true,
|
||||||
): void {
|
): void {
|
||||||
$this->verifyTableNodeColumns($table, ['username'], ['displayname', 'email', 'password']);
|
$this->verifyTableNodeColumns($table, ['username'], ['displayname', 'email', 'password']);
|
||||||
$table = $table->getColumnsHash();
|
$table = $table->getColumnsHash();
|
||||||
@@ -550,7 +550,7 @@ trait Provisioning {
|
|||||||
$requests = [];
|
$requests = [];
|
||||||
$client = HttpRequestHelper::createClient(
|
$client = HttpRequestHelper::createClient(
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword()
|
$this->getAdminPassword(),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($users as $userAttributes) {
|
foreach ($users as $userAttributes) {
|
||||||
@@ -564,7 +564,7 @@ trait Provisioning {
|
|||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
'userid',
|
'userid',
|
||||||
$userAttributes,
|
$userAttributes,
|
||||||
__METHOD__ . " userAttributes array does not have key 'userid'"
|
__METHOD__ . " userAttributes array does not have key 'userid'",
|
||||||
);
|
);
|
||||||
$attributesToCreateUser['email'] = $userAttributes['userid'] . '@owncloud.com';
|
$attributesToCreateUser['email'] = $userAttributes['userid'] . '@owncloud.com';
|
||||||
} else {
|
} else {
|
||||||
@@ -574,7 +574,7 @@ trait Provisioning {
|
|||||||
$attributesToCreateUser['userid'],
|
$attributesToCreateUser['userid'],
|
||||||
$attributesToCreateUser['password'],
|
$attributesToCreateUser['password'],
|
||||||
$attributesToCreateUser['email'],
|
$attributesToCreateUser['email'],
|
||||||
$attributesToCreateUser['displayname']
|
$attributesToCreateUser['displayname'],
|
||||||
);
|
);
|
||||||
$request = GraphHelper::createRequest(
|
$request = GraphHelper::createRequest(
|
||||||
$this->getBaseUrl(),
|
$this->getBaseUrl(),
|
||||||
@@ -603,7 +603,7 @@ trait Provisioning {
|
|||||||
$users[$key]['userid'] . "'" .
|
$users[$key]['userid'] . "'" .
|
||||||
"\nHTTP status $httpStatusCode " .
|
"\nHTTP status $httpStatusCode " .
|
||||||
"\nGraph status $graphStatusCode " .
|
"\nGraph status $graphStatusCode " .
|
||||||
"\nError message $messageText"
|
"\nError message $messageText",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -625,7 +625,7 @@ trait Provisioning {
|
|||||||
$userAttributes['password'],
|
$userAttributes['password'],
|
||||||
$userAttributes['displayName'],
|
$userAttributes['displayName'],
|
||||||
$userAttributes['email'],
|
$userAttributes['email'],
|
||||||
$userAttributes['id']
|
$userAttributes['id'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,7 +636,7 @@ trait Provisioning {
|
|||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$this->userExists($user["userid"]),
|
$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->userResetUserPasswordUsingProvisioningApi(
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$username,
|
$username,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,14 +671,14 @@ trait Provisioning {
|
|||||||
public function userResetUserPasswordUsingProvisioningApi(
|
public function userResetUserPasswordUsingProvisioningApi(
|
||||||
?string $user,
|
?string $user,
|
||||||
?string $username,
|
?string $username,
|
||||||
?string $password
|
?string $password,
|
||||||
): void {
|
): void {
|
||||||
$targetUsername = $this->getActualUsername($username);
|
$targetUsername = $this->getActualUsername($username);
|
||||||
$password = $this->getActualPassword($password);
|
$password = $this->getActualPassword($password);
|
||||||
$this->userTriesToResetUserPasswordUsingTheProvisioningApi(
|
$this->userTriesToResetUserPasswordUsingTheProvisioningApi(
|
||||||
$user,
|
$user,
|
||||||
$targetUsername,
|
$targetUsername,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$this->rememberUserPassword($targetUsername, $password);
|
$this->rememberUserPassword($targetUsername, $password);
|
||||||
}
|
}
|
||||||
@@ -693,7 +693,7 @@ trait Provisioning {
|
|||||||
public function userTriesToResetUserPasswordUsingTheProvisioningApi(
|
public function userTriesToResetUserPasswordUsingTheProvisioningApi(
|
||||||
?string $user,
|
?string $user,
|
||||||
?string $username,
|
?string $username,
|
||||||
?string $password
|
?string $password,
|
||||||
): void {
|
): void {
|
||||||
$password = $this->getActualPassword($password);
|
$password = $this->getActualPassword($password);
|
||||||
$bodyTable = new TableNode([['key', 'password'], ['value', $password]]);
|
$bodyTable = new TableNode([['key', 'password'], ['value', $password]]);
|
||||||
@@ -701,7 +701,7 @@ trait Provisioning {
|
|||||||
$user,
|
$user,
|
||||||
"PUT",
|
"PUT",
|
||||||
"/cloud/users/$username",
|
"/cloud/users/$username",
|
||||||
$bodyTable
|
$bodyTable,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -730,7 +730,7 @@ trait Provisioning {
|
|||||||
public function userShouldExist(string $user): void {
|
public function userShouldExist(string $user): void {
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$this->userExists($user),
|
$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);
|
$user = $this->getActualUsername($user);
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
$this->userExists($user),
|
$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 {
|
public function groupShouldExist(string $group): void {
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$this->groupExists($group),
|
$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 {
|
public function groupShouldNotExist(string $group): void {
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
$this->groupExists($group),
|
$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(
|
throw new Exception(
|
||||||
"group '" . $row['groupname'] .
|
"group '" . $row['groupname'] .
|
||||||
"' does" . ($should ? " not" : "") .
|
"' does" . ($should ? " not" : "") .
|
||||||
" exist but should" . ($should ? "" : " not")
|
" exist but should" . ($should ? "" : " not"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ trait Provisioning {
|
|||||||
}
|
}
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
$this->userExists($user),
|
$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(
|
$this->initializeUser(
|
||||||
$row ['username'],
|
$row ['username'],
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -869,7 +869,7 @@ trait Provisioning {
|
|||||||
return HttpRequestHelper::get(
|
return HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword()
|
$this->getAdminPassword(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -887,7 +887,7 @@ trait Provisioning {
|
|||||||
$this->response = HttpRequestHelper::get(
|
$this->response = HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$actualUser,
|
$actualUser,
|
||||||
$actualPassword
|
$actualPassword,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -901,7 +901,7 @@ trait Provisioning {
|
|||||||
*/
|
*/
|
||||||
public function userGetsTheListOfAllUsersUsingTheProvisioningApi(string $user): void {
|
public function userGetsTheListOfAllUsersUsingTheProvisioningApi(string $user): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->userGetsTheListOfAllUsers($user)
|
$this->userGetsTheListOfAllUsers($user),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -917,7 +917,7 @@ trait Provisioning {
|
|||||||
return HttpRequestHelper::get(
|
return HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$actualUser,
|
$actualUser,
|
||||||
$actualPassword
|
$actualPassword,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,7 +936,7 @@ trait Provisioning {
|
|||||||
HttpRequestHelper::get(
|
HttpRequestHelper::get(
|
||||||
$url,
|
$url,
|
||||||
$user,
|
$user,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -968,7 +968,7 @@ trait Provisioning {
|
|||||||
?string $displayName = null,
|
?string $displayName = null,
|
||||||
?string $email = null,
|
?string $email = null,
|
||||||
?string $userId = null,
|
?string $userId = null,
|
||||||
bool $shouldExist = true
|
bool $shouldExist = true,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->getActualUsername($user);
|
$user = $this->getActualUsername($user);
|
||||||
$normalizedUsername = $this->normalizeUsername($user);
|
$normalizedUsername = $this->normalizeUsername($user);
|
||||||
@@ -997,7 +997,7 @@ trait Provisioning {
|
|||||||
*/
|
*/
|
||||||
public function rememberUserPassword(
|
public function rememberUserPassword(
|
||||||
string $user,
|
string $user,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$normalizedUsername = $this->normalizeUsername($user);
|
$normalizedUsername = $this->normalizeUsername($user);
|
||||||
if (\array_key_exists($normalizedUsername, $this->createdUsers)) {
|
if (\array_key_exists($normalizedUsername, $this->createdUsers)) {
|
||||||
@@ -1055,7 +1055,7 @@ trait Provisioning {
|
|||||||
*/
|
*/
|
||||||
public function userHasBeenCreated(
|
public function userHasBeenCreated(
|
||||||
array $userData,
|
array $userData,
|
||||||
string $byUser = null
|
string $byUser = null,
|
||||||
): void {
|
): void {
|
||||||
$userId = null;
|
$userId = null;
|
||||||
|
|
||||||
@@ -1095,7 +1095,7 @@ trait Provisioning {
|
|||||||
$this->createLdapUser($setting);
|
$this->createLdapUser($setting);
|
||||||
} catch (LdapException $exception) {
|
} catch (LdapException $exception) {
|
||||||
throw new 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 {
|
} else {
|
||||||
@@ -1113,7 +1113,7 @@ trait Provisioning {
|
|||||||
201,
|
201,
|
||||||
$response->getStatusCode(),
|
$response->getStatusCode(),
|
||||||
__METHOD__ . " cannot create user '$user' using Graph API.\nResponse:" .
|
__METHOD__ . " cannot create user '$user' using Graph API.\nResponse:" .
|
||||||
json_encode($this->getJsonDecodedResponse($response))
|
json_encode($this->getJsonDecodedResponse($response)),
|
||||||
);
|
);
|
||||||
$userId = $this->getJsonDecodedResponse($response)['id'];
|
$userId = $this->getJsonDecodedResponse($response)['id'];
|
||||||
}
|
}
|
||||||
@@ -1122,7 +1122,7 @@ trait Provisioning {
|
|||||||
|
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$this->userExists($user),
|
$this->userExists($user),
|
||||||
"User '$user' should exist but does not exist"
|
"User '$user' should exist but does not exist",
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->initializeUser($user, $password);
|
$this->initializeUser($user, $password);
|
||||||
@@ -1146,14 +1146,14 @@ trait Provisioning {
|
|||||||
$group,
|
$group,
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword(),
|
$this->getAdminPassword(),
|
||||||
$this->ocsApiVersion
|
$this->ocsApiVersion,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->setResponse(
|
$this->setResponse(
|
||||||
$this->graphContext->removeUserFromGroup(
|
$this->graphContext->removeUserFromGroup(
|
||||||
$group,
|
$group,
|
||||||
$user
|
$user,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1179,7 +1179,7 @@ trait Provisioning {
|
|||||||
$expectedGroups,
|
$expectedGroups,
|
||||||
$respondedArray,
|
$respondedArray,
|
||||||
__METHOD__
|
__METHOD__
|
||||||
. " Provided groups do not match the groups returned in the response."
|
. " Provided groups do not match the groups returned in the response.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->graphContext->theseGroupsShouldBeInTheResponse($groupsSimplified);
|
$this->graphContext->theseGroupsShouldBeInTheResponse($groupsSimplified);
|
||||||
@@ -1207,7 +1207,7 @@ trait Provisioning {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
\error_log(
|
\error_log(
|
||||||
"INFORMATION: There was an unexpected problem trying to delete group " .
|
"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(
|
\error_log(
|
||||||
"INFORMATION: tried to delete group '$group'" .
|
"INFORMATION: tried to delete group '$group'" .
|
||||||
" at the end of the scenario but it seems to still exist. " .
|
" 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(
|
$response = HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$requestingUser,
|
$requestingUser,
|
||||||
$requestingPassword
|
$requestingPassword,
|
||||||
);
|
);
|
||||||
if ($response->getStatusCode() >= 400) {
|
if ($response->getStatusCode() >= 400) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1273,7 +1273,7 @@ trait Provisioning {
|
|||||||
$respondedArray,
|
$respondedArray,
|
||||||
__METHOD__ . " Group '$group' does not exist in '"
|
__METHOD__ . " Group '$group' does not exist in '"
|
||||||
. \implode(', ', $respondedArray)
|
. \implode(', ', $respondedArray)
|
||||||
. "'"
|
. "'",
|
||||||
);
|
);
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
@@ -1281,12 +1281,12 @@ trait Provisioning {
|
|||||||
__METHOD__
|
__METHOD__
|
||||||
. " Expected status code is '200' but got '"
|
. " Expected status code is '200' but got '"
|
||||||
. $this->response->getStatusCode()
|
. $this->response->getStatusCode()
|
||||||
. "'"
|
. "'",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->graphContext->userShouldBeMemberInGroupUsingTheGraphApi(
|
$this->graphContext->userShouldBeMemberInGroupUsingTheGraphApi(
|
||||||
$user,
|
$user,
|
||||||
$group
|
$group,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1310,14 +1310,14 @@ trait Provisioning {
|
|||||||
$response = HttpRequestHelper::get(
|
$response = HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword()
|
$this->getAdminPassword(),
|
||||||
);
|
);
|
||||||
$respondedArray = $this->getArrayOfGroupsResponded($response);
|
$respondedArray = $this->getArrayOfGroupsResponded($response);
|
||||||
\sort($respondedArray);
|
\sort($respondedArray);
|
||||||
Assert::assertNotContains($group, $respondedArray);
|
Assert::assertNotContains($group, $respondedArray);
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode()
|
$response->getStatusCode(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->graphContext->userShouldNotBeMemberInGroupUsingTheGraphApi($user, $group);
|
$this->graphContext->userShouldNotBeMemberInGroupUsingTheGraphApi($user, $group);
|
||||||
@@ -1339,7 +1339,7 @@ trait Provisioning {
|
|||||||
$response = HttpRequestHelper::get(
|
$response = HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword()
|
$this->getAdminPassword(),
|
||||||
);
|
);
|
||||||
Assert::assertNotContains($username, $this->getArrayOfUsersResponded($response));
|
Assert::assertNotContains($username, $this->getArrayOfUsersResponded($response));
|
||||||
}
|
}
|
||||||
@@ -1373,11 +1373,11 @@ trait Provisioning {
|
|||||||
try {
|
try {
|
||||||
$this->addUserToLdapGroup(
|
$this->addUserToLdapGroup(
|
||||||
$user,
|
$user,
|
||||||
$group
|
$group,
|
||||||
);
|
);
|
||||||
} catch (LdapException $exception) {
|
} catch (LdapException $exception) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"User $user cannot be added to $group Error: $exception"
|
"User $user cannot be added to $group Error: $exception",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1404,11 +1404,11 @@ trait Provisioning {
|
|||||||
try {
|
try {
|
||||||
$this->addUserToLdapGroup(
|
$this->addUserToLdapGroup(
|
||||||
$user,
|
$user,
|
||||||
$group
|
$group,
|
||||||
);
|
);
|
||||||
} catch (LdapException $exception) {
|
} catch (LdapException $exception) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"User $user cannot be added to $group Error: $exception"
|
"User $user cannot be added to $group Error: $exception",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1430,7 +1430,7 @@ trait Provisioning {
|
|||||||
string $group,
|
string $group,
|
||||||
bool $shouldExist = true,
|
bool $shouldExist = true,
|
||||||
bool $possibleToDelete = true,
|
bool $possibleToDelete = true,
|
||||||
?string $id = null
|
?string $id = null,
|
||||||
): void {
|
): void {
|
||||||
$groupData = [
|
$groupData = [
|
||||||
"shouldExist" => $shouldExist,
|
"shouldExist" => $shouldExist,
|
||||||
@@ -1477,7 +1477,7 @@ trait Provisioning {
|
|||||||
$this->createTheGroup($group);
|
$this->createTheGroup($group);
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$this->groupExists($group),
|
$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);
|
$this->createLdapGroup($group);
|
||||||
} catch (LdapException $e) {
|
} catch (LdapException $e) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"could not create group '$group'. Error: $e"
|
"could not create group '$group'. Error: $e",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1537,7 +1537,7 @@ trait Provisioning {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
"Invalid method to create group '$group'"
|
"Invalid method to create group '$group'",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1557,7 +1557,7 @@ trait Provisioning {
|
|||||||
string $attribute,
|
string $attribute,
|
||||||
string $entry,
|
string $entry,
|
||||||
string $value,
|
string $value,
|
||||||
bool $append = false
|
bool $append = false,
|
||||||
): void {
|
): void {
|
||||||
$ldapEntry = $this->ldap->getEntry($entry . "," . $this->ldapBaseDN);
|
$ldapEntry = $this->ldap->getEntry($entry . "," . $this->ldapBaseDN);
|
||||||
Laminas\Ldap\Attribute::setAttribute($ldapEntry, $attribute, $value, $append);
|
Laminas\Ldap\Attribute::setAttribute($ldapEntry, $attribute, $value, $append);
|
||||||
@@ -1588,7 +1588,7 @@ trait Provisioning {
|
|||||||
$memberAttr,
|
$memberAttr,
|
||||||
"cn=$group,ou=$ou",
|
"cn=$group,ou=$ou",
|
||||||
$memberValue,
|
$memberValue,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1602,7 +1602,7 @@ trait Provisioning {
|
|||||||
public function deleteValueFromLdapAttribute(string $value, string $attribute, string $entry): void {
|
public function deleteValueFromLdapAttribute(string $value, string $attribute, string $entry): void {
|
||||||
$this->ldap->deleteAttributes(
|
$this->ldap->deleteAttributes(
|
||||||
$entry . "," . $this->ldapBaseDN,
|
$entry . "," . $this->ldapBaseDN,
|
||||||
[$attribute => [$value]]
|
[$attribute => [$value]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1629,7 +1629,7 @@ trait Provisioning {
|
|||||||
$this->deleteValueFromLdapAttribute(
|
$this->deleteValueFromLdapAttribute(
|
||||||
$memberValue,
|
$memberValue,
|
||||||
$memberAttr,
|
$memberAttr,
|
||||||
"cn=$group,ou=$ou"
|
"cn=$group,ou=$ou",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1673,7 +1673,7 @@ trait Provisioning {
|
|||||||
public function deleteLdapUser(?string $username, ?string $ou = null): void {
|
public function deleteLdapUser(?string $username, ?string $ou = null): void {
|
||||||
if (!\in_array($username, $this->ldapCreatedUsers)) {
|
if (!\in_array($username, $this->ldapCreatedUsers)) {
|
||||||
throw new Error(
|
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) {
|
if ($ou === null) {
|
||||||
@@ -1708,7 +1708,7 @@ trait Provisioning {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
@@ -1734,7 +1734,7 @@ trait Provisioning {
|
|||||||
$user,
|
$user,
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword(),
|
$this->getAdminPassword(),
|
||||||
$this->ocsApiVersion
|
$this->ocsApiVersion,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// users can be deleted using the username in the GraphApi too
|
// users can be deleted using the username in the GraphApi too
|
||||||
@@ -1765,7 +1765,7 @@ trait Provisioning {
|
|||||||
$this->rememberThatGroupIsNotExpectedToExist($group);
|
$this->rememberThatGroupIsNotExpectedToExist($group);
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
$this->groupExists($group),
|
$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(
|
$this->response = HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword()
|
$this->getAdminPassword(),
|
||||||
);
|
);
|
||||||
if ($this->response->getStatusCode() >= 400) {
|
if ($this->response->getStatusCode() >= 400) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1824,14 +1824,14 @@ trait Provisioning {
|
|||||||
$response = HttpRequestHelper::get(
|
$response = HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$this->getAdminUsername(),
|
$this->getAdminUsername(),
|
||||||
$this->getAdminPassword()
|
$this->getAdminPassword(),
|
||||||
);
|
);
|
||||||
$respondedArray = $this->getArrayOfGroupsResponded($response);
|
$respondedArray = $this->getArrayOfGroupsResponded($response);
|
||||||
\sort($respondedArray);
|
\sort($respondedArray);
|
||||||
Assert::assertNotContains($group, $respondedArray);
|
Assert::assertNotContains($group, $respondedArray);
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
200,
|
200,
|
||||||
$response->getStatusCode()
|
$response->getStatusCode(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->graphContext->userShouldNotBeMemberInGroupUsingTheGraphApi($user, $group);
|
$this->graphContext->userShouldNotBeMemberInGroupUsingTheGraphApi($user, $group);
|
||||||
@@ -1853,7 +1853,7 @@ trait Provisioning {
|
|||||||
function ($user) {
|
function ($user) {
|
||||||
return $this->getActualUsername($user);
|
return $this->getActualUsername($user);
|
||||||
},
|
},
|
||||||
$this->simplifyArray($users)
|
$this->simplifyArray($users),
|
||||||
);
|
);
|
||||||
if ($this->isTestingWithLdap()) {
|
if ($this->isTestingWithLdap()) {
|
||||||
$respondedArray = $this->getArrayOfUsersResponded($this->response);
|
$respondedArray = $this->getArrayOfUsersResponded($this->response);
|
||||||
@@ -1861,7 +1861,7 @@ trait Provisioning {
|
|||||||
$usersSimplified,
|
$usersSimplified,
|
||||||
$respondedArray,
|
$respondedArray,
|
||||||
__METHOD__
|
__METHOD__
|
||||||
. " Provided users do not match the users returned in the response."
|
. " Provided users do not match the users returned in the response.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->graphContext->theseUsersShouldBeInTheResponse($usersSimplified);
|
$this->graphContext->theseUsersShouldBeInTheResponse($usersSimplified);
|
||||||
@@ -1918,7 +1918,7 @@ trait Provisioning {
|
|||||||
$responseData = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0];
|
$responseData = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0];
|
||||||
Assert::assertEmpty(
|
Assert::assertEmpty(
|
||||||
$responseData,
|
$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);
|
$this->theHTTPStatusCodeShouldBe(204, "Failed to delete user '$user'", $response);
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
$this->userExists($user),
|
$this->userExists($user),
|
||||||
"User '$user' should not exist but does exist"
|
"User '$user' should not exist but does exist",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->usingServer($previousServer);
|
$this->usingServer($previousServer);
|
||||||
@@ -2026,7 +2026,7 @@ trait Provisioning {
|
|||||||
return HttpRequestHelper::put(
|
return HttpRequestHelper::put(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$actualUser,
|
$actualUser,
|
||||||
$actualPassword
|
$actualPassword,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class PublicWebDavContext implements Context {
|
|||||||
return $this->downloadFileFromPublicFolder(
|
return $this->downloadFileFromPublicFolder(
|
||||||
$path,
|
$path,
|
||||||
$password,
|
$password,
|
||||||
$range
|
$range,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userTriesToDownloadFileFromPublicLinkUsingBasicAuthAndPublicWebdav(
|
public function userTriesToDownloadFileFromPublicLinkUsingBasicAuthAndPublicWebdav(
|
||||||
string $user,
|
string $user,
|
||||||
string $path
|
string $path,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadFromPublicLinkAsUser($path, $user);
|
$response = $this->downloadFromPublicLinkAsUser($path, $user);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -108,10 +108,10 @@ class PublicWebDavContext implements Context {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function thePublicDeletesFileFolderFromTheLastPublicLinkShareUsingThePublicWebdavApi(
|
public function thePublicDeletesFileFolderFromTheLastPublicLinkShareUsingThePublicWebdavApi(
|
||||||
string $fileName
|
string $fileName,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->deleteFileFromPublicShare(
|
$response = $this->deleteFileFromPublicShare(
|
||||||
$fileName
|
$fileName,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
@@ -130,13 +130,13 @@ class PublicWebDavContext implements Context {
|
|||||||
$davPath = WebDavHelper::getDavPath(
|
$davPath = WebDavHelper::getDavPath(
|
||||||
WebDavHelper::DAV_VERSION_NEW,
|
WebDavHelper::DAV_VERSION_NEW,
|
||||||
$token,
|
$token,
|
||||||
"public-files"
|
"public-files",
|
||||||
);
|
);
|
||||||
$password = $this->featureContext->getActualPassword($password);
|
$password = $this->featureContext->getActualPassword($password);
|
||||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileName";
|
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileName";
|
||||||
$userName = $this->getUsernameForPublicWebdavApi(
|
$userName = $this->getUsernameForPublicWebdavApi(
|
||||||
$token,
|
$token,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$headers = [
|
$headers = [
|
||||||
'X-Requested-With' => 'XMLHttpRequest',
|
'X-Requested-With' => 'XMLHttpRequest',
|
||||||
@@ -145,7 +145,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$fullUrl,
|
$fullUrl,
|
||||||
$userName,
|
$userName,
|
||||||
$password,
|
$password,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function thePublicHasDeletedFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(
|
public function thePublicHasDeletedFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(
|
||||||
string $file,
|
string $file,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->deleteFileFromPublicShare($file, $password);
|
$response = $this->deleteFileFromPublicShare($file, $password);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
||||||
@@ -175,10 +175,10 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function thePublicDeletesFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(
|
public function thePublicDeletesFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(
|
||||||
string $file,
|
string $file,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->deleteFileFromPublicShare($file, $password)
|
$this->deleteFileFromPublicShare($file, $password),
|
||||||
);
|
);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ class PublicWebDavContext implements Context {
|
|||||||
public function renameFileFromPublicShare(
|
public function renameFileFromPublicShare(
|
||||||
string $fileName,
|
string $fileName,
|
||||||
string $toFileName,
|
string $toFileName,
|
||||||
?string $password = ""
|
?string $password = "",
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$token = ($this->featureContext->isUsingSharingNG())
|
$token = ($this->featureContext->isUsingSharingNG())
|
||||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||||
@@ -201,14 +201,14 @@ class PublicWebDavContext implements Context {
|
|||||||
$davPath = WebDavHelper::getDavPath(
|
$davPath = WebDavHelper::getDavPath(
|
||||||
WebDavHelper::DAV_VERSION_NEW,
|
WebDavHelper::DAV_VERSION_NEW,
|
||||||
$token,
|
$token,
|
||||||
"public-files"
|
"public-files",
|
||||||
);
|
);
|
||||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileName";
|
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileName";
|
||||||
$password = $this->featureContext->getActualPassword($password);
|
$password = $this->featureContext->getActualPassword($password);
|
||||||
$destination = $this->featureContext->getBaseUrl() . "/$davPath/$toFileName";
|
$destination = $this->featureContext->getBaseUrl() . "/$davPath/$toFileName";
|
||||||
$userName = $this->getUsernameForPublicWebdavApi(
|
$userName = $this->getUsernameForPublicWebdavApi(
|
||||||
$token,
|
$token,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$headers = [
|
$headers = [
|
||||||
'X-Requested-With' => 'XMLHttpRequest',
|
'X-Requested-With' => 'XMLHttpRequest',
|
||||||
@@ -219,7 +219,7 @@ class PublicWebDavContext implements Context {
|
|||||||
"MOVE",
|
"MOVE",
|
||||||
$userName,
|
$userName,
|
||||||
$password,
|
$password,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,10 +235,10 @@ class PublicWebDavContext implements Context {
|
|||||||
public function thePublicRenamesFileFromTheLastPublicShareUsingThePasswordPasswordAndOldPublicWebdavApi(
|
public function thePublicRenamesFileFromTheLastPublicShareUsingThePasswordPasswordAndOldPublicWebdavApi(
|
||||||
string $fileName,
|
string $fileName,
|
||||||
string $toName,
|
string $toName,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->renameFileFromPublicShare($fileName, $toName, $password)
|
$this->renameFileFromPublicShare($fileName, $toName, $password),
|
||||||
);
|
);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
}
|
}
|
||||||
@@ -254,13 +254,13 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function publicDownloadsFileFromInsideLastPublicSharedFolderWithPassword(
|
public function publicDownloadsFileFromInsideLastPublicSharedFolderWithPassword(
|
||||||
string $path,
|
string $path,
|
||||||
string $password = ""
|
string $password = "",
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadFileFromPublicFolder(
|
$response = $this->downloadFileFromPublicFolder(
|
||||||
$path,
|
$path,
|
||||||
$password,
|
$password,
|
||||||
"",
|
"",
|
||||||
$this->featureContext->isUsingSharingNG()
|
$this->featureContext->isUsingSharingNG(),
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -280,7 +280,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$davPath = WebDavHelper::getDavPath(
|
$davPath = WebDavHelper::getDavPath(
|
||||||
$this->featureContext->getDavPathVersion(),
|
$this->featureContext->getDavPathVersion(),
|
||||||
$token,
|
$token,
|
||||||
"public-files"
|
"public-files",
|
||||||
);
|
);
|
||||||
|
|
||||||
$username = $this->featureContext->getActualUsername($user);
|
$username = $this->featureContext->getActualUsername($user);
|
||||||
@@ -290,7 +290,7 @@ class PublicWebDavContext implements Context {
|
|||||||
return HttpRequestHelper::get(
|
return HttpRequestHelper::get(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
$username,
|
$username,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -305,7 +305,7 @@ class PublicWebDavContext implements Context {
|
|||||||
string $path,
|
string $path,
|
||||||
string $password,
|
string $password,
|
||||||
string $range,
|
string $range,
|
||||||
bool $shareNg = false
|
bool $shareNg = false,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$path = \ltrim($path, "/");
|
$path = \ltrim($path, "/");
|
||||||
$password = $this->featureContext->getActualPassword($password);
|
$password = $this->featureContext->getActualPassword($password);
|
||||||
@@ -317,12 +317,12 @@ class PublicWebDavContext implements Context {
|
|||||||
$davPath = WebDavHelper::getDavPath(
|
$davPath = WebDavHelper::getDavPath(
|
||||||
WebDavHelper::DAV_VERSION_NEW,
|
WebDavHelper::DAV_VERSION_NEW,
|
||||||
$token,
|
$token,
|
||||||
"public-files"
|
"public-files",
|
||||||
);
|
);
|
||||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$path";
|
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$path";
|
||||||
$userName = $this->getUsernameForPublicWebdavApi(
|
$userName = $this->getUsernameForPublicWebdavApi(
|
||||||
$token,
|
$token,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
|
|
||||||
$headers = [
|
$headers = [
|
||||||
@@ -335,7 +335,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$fullUrl,
|
$fullUrl,
|
||||||
$userName,
|
$userName,
|
||||||
$password,
|
$password,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ class PublicWebDavContext implements Context {
|
|||||||
return $this->publicUploadContent(
|
return $this->publicUploadContent(
|
||||||
\basename($source),
|
\basename($source),
|
||||||
'',
|
'',
|
||||||
\file_get_contents($source)
|
\file_get_contents($source),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,11 +367,11 @@ class PublicWebDavContext implements Context {
|
|||||||
public function publiclyCopyingFile(
|
public function publiclyCopyingFile(
|
||||||
string $baseUrl,
|
string $baseUrl,
|
||||||
string $source,
|
string $source,
|
||||||
string $destination
|
string $destination,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$fullSourceUrl = "$baseUrl/$source";
|
$fullSourceUrl = "$baseUrl/$source";
|
||||||
$fullDestUrl = WebDavHelper::sanitizeUrl(
|
$fullDestUrl = WebDavHelper::sanitizeUrl(
|
||||||
"$baseUrl/$destination"
|
"$baseUrl/$destination",
|
||||||
);
|
);
|
||||||
|
|
||||||
$headers["Destination"] = $fullDestUrl;
|
$headers["Destination"] = $fullDestUrl;
|
||||||
@@ -380,7 +380,7 @@ class PublicWebDavContext implements Context {
|
|||||||
"COPY",
|
"COPY",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,14 +399,14 @@ class PublicWebDavContext implements Context {
|
|||||||
$davPath = WebDavHelper::getDavPath(
|
$davPath = WebDavHelper::getDavPath(
|
||||||
WebDavHelper::DAV_VERSION_NEW,
|
WebDavHelper::DAV_VERSION_NEW,
|
||||||
$token,
|
$token,
|
||||||
"public-files"
|
"public-files",
|
||||||
);
|
);
|
||||||
$baseUrl = $this->featureContext->getLocalBaseUrl() . '/' . $davPath;
|
$baseUrl = $this->featureContext->getLocalBaseUrl() . '/' . $davPath;
|
||||||
|
|
||||||
$response = $this->publiclyCopyingFile(
|
$response = $this->publiclyCopyingFile(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
$source,
|
$source,
|
||||||
$destination
|
$destination,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,7 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function thePublicHasUploadedFileWithContentWithAutoRenameMode(
|
public function thePublicHasUploadedFileWithContentWithAutoRenameMode(
|
||||||
string $filename,
|
string $filename,
|
||||||
string $body = 'test'
|
string $body = 'test',
|
||||||
): void {
|
): void {
|
||||||
$response = $this->publiclyUploadingContentAutoRename($filename, $body);
|
$response = $this->publiclyUploadingContentAutoRename($filename, $body);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
||||||
@@ -486,7 +486,7 @@ class PublicWebDavContext implements Context {
|
|||||||
public function thePublicHasUploadedFileWithContentAndPasswordToLastLinkShareUsingPublicWebdavApi(
|
public function thePublicHasUploadedFileWithContentAndPasswordToLastLinkShareUsingPublicWebdavApi(
|
||||||
string $filename,
|
string $filename,
|
||||||
string $content = 'test',
|
string $content = 'test',
|
||||||
string $password = ''
|
string $password = '',
|
||||||
): void {
|
): void {
|
||||||
$response = $this->publiclyUploadingContentWithPassword(
|
$response = $this->publiclyUploadingContentWithPassword(
|
||||||
$filename,
|
$filename,
|
||||||
@@ -513,7 +513,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$response = $this->publiclyUploadingContentWithPassword(
|
$response = $this->publiclyUploadingContentWithPassword(
|
||||||
$filename,
|
$filename,
|
||||||
$password,
|
$password,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -541,7 +541,7 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function thePublicUploadsFileWithContentUsingThePublicWebDavApi(
|
public function thePublicUploadsFileWithContentUsingThePublicWebDavApi(
|
||||||
string $filename,
|
string $filename,
|
||||||
string $body = 'test'
|
string $body = 'test',
|
||||||
): void {
|
): void {
|
||||||
$response = $this->publicUploadContent($filename, '', $body);
|
$response = $this->publicUploadContent($filename, '', $body);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -572,11 +572,11 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function checkLastPublicSharedFileWithPasswordDownload(
|
public function checkLastPublicSharedFileWithPasswordDownload(
|
||||||
string $password,
|
string $password,
|
||||||
string $expectedContent
|
string $expectedContent,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadPublicFileWithRange(
|
$response = $this->downloadPublicFileWithRange(
|
||||||
"",
|
"",
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
@@ -584,7 +584,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$this->featureContext->checkDownloadedContentMatches(
|
$this->featureContext->checkDownloadedContentMatches(
|
||||||
$expectedContent,
|
$expectedContent,
|
||||||
"Checking the content of the last public shared file after downloading with the public WebDAV API",
|
"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(
|
public function shouldNotBeAbleToDownloadFileInsidePublicSharedFolder(
|
||||||
string $path,
|
string $path,
|
||||||
string $expectedHttpCode = "401"
|
string $expectedHttpCode = "401",
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadFileFromPublicFolder(
|
$response = $this->downloadFileFromPublicFolder(
|
||||||
$path,
|
$path,
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
$this->featureContext->isUsingSharingNG()
|
$this->featureContext->isUsingSharingNG(),
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
||||||
}
|
}
|
||||||
@@ -620,13 +620,13 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPassword(
|
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPassword(
|
||||||
string $path,
|
string $path,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadFileFromPublicFolder(
|
$response = $this->downloadFileFromPublicFolder(
|
||||||
$path,
|
$path,
|
||||||
$password,
|
$password,
|
||||||
"",
|
"",
|
||||||
$this->featureContext->isUsingSharingNG()
|
$this->featureContext->isUsingSharingNG(),
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
}
|
}
|
||||||
@@ -644,7 +644,7 @@ class PublicWebDavContext implements Context {
|
|||||||
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordAndContentShouldBe(
|
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordAndContentShouldBe(
|
||||||
string $path,
|
string $path,
|
||||||
string $password,
|
string $password,
|
||||||
string $content
|
string $content,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadFileFromPublicFolder(
|
$response = $this->downloadFileFromPublicFolder(
|
||||||
$path,
|
$path,
|
||||||
@@ -669,13 +669,13 @@ class PublicWebDavContext implements Context {
|
|||||||
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordForSharingNGAndContentShouldBe(
|
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordForSharingNGAndContentShouldBe(
|
||||||
string $path,
|
string $path,
|
||||||
string $password,
|
string $password,
|
||||||
string $content
|
string $content,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadFileFromPublicFolder(
|
$response = $this->downloadFileFromPublicFolder(
|
||||||
$path,
|
$path,
|
||||||
$password,
|
$password,
|
||||||
"",
|
"",
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
@@ -695,13 +695,13 @@ class PublicWebDavContext implements Context {
|
|||||||
public function shouldNotBeAbleToDownloadFileInsidePublicSharedFolderWithPassword(
|
public function shouldNotBeAbleToDownloadFileInsidePublicSharedFolderWithPassword(
|
||||||
string $path,
|
string $path,
|
||||||
string $password,
|
string $password,
|
||||||
string $expectedHttpCode = "401"
|
string $expectedHttpCode = "401",
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadFileFromPublicFolder(
|
$response = $this->downloadFileFromPublicFolder(
|
||||||
$path,
|
$path,
|
||||||
$password,
|
$password,
|
||||||
"",
|
"",
|
||||||
$this->featureContext->isUsingSharingNG()
|
$this->featureContext->isUsingSharingNG(),
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
||||||
}
|
}
|
||||||
@@ -718,14 +718,14 @@ class PublicWebDavContext implements Context {
|
|||||||
public function shouldNotBeAbleToDownloadFileWithPasswordForShareNg(
|
public function shouldNotBeAbleToDownloadFileWithPasswordForShareNg(
|
||||||
string $path,
|
string $path,
|
||||||
string $password,
|
string $password,
|
||||||
string $expectedHttpCode = "401"
|
string $expectedHttpCode = "401",
|
||||||
): void {
|
): void {
|
||||||
$this->tryingToDownloadUsingWebDAVAPI(
|
$this->tryingToDownloadUsingWebDAVAPI(
|
||||||
$path,
|
$path,
|
||||||
"new",
|
"new",
|
||||||
$password,
|
$password,
|
||||||
$expectedHttpCode,
|
$expectedHttpCode,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -743,13 +743,13 @@ class PublicWebDavContext implements Context {
|
|||||||
string $password,
|
string $password,
|
||||||
string $range = "",
|
string $range = "",
|
||||||
string $expectedHttpCode = "401",
|
string $expectedHttpCode = "401",
|
||||||
bool $shareNg = false
|
bool $shareNg = false,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->downloadFileFromPublicFolder(
|
$response = $this->downloadFileFromPublicFolder(
|
||||||
$path,
|
$path,
|
||||||
$password,
|
$password,
|
||||||
$range,
|
$range,
|
||||||
$shareNg
|
$shareNg,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
||||||
}
|
}
|
||||||
@@ -765,13 +765,13 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function publiclyUploadingShouldToSharedFileShouldFail(
|
public function publiclyUploadingShouldToSharedFileShouldFail(
|
||||||
string $password,
|
string $password,
|
||||||
string $expectedHttpCode
|
string $expectedHttpCode,
|
||||||
): void {
|
): void {
|
||||||
$filename = (string)$this->featureContext->getLastCreatedPublicShare()->file_target;
|
$filename = (string)$this->featureContext->getLastCreatedPublicShare()->file_target;
|
||||||
|
|
||||||
$response = $this->publicUploadContent(
|
$response = $this->publicUploadContent(
|
||||||
$filename,
|
$filename,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe($expectedHttpCode, "", $response);
|
||||||
@@ -787,16 +787,16 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function publiclyUploadingWithPasswordShouldNotWork(
|
public function publiclyUploadingWithPasswordShouldNotWork(
|
||||||
string $password,
|
string $password,
|
||||||
string $expectedHttpCode = null
|
string $expectedHttpCode = null,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->publicUploadContent(
|
$response = $this->publicUploadContent(
|
||||||
'whateverfilefortesting.txt',
|
'whateverfilefortesting.txt',
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
Assert::assertGreaterThanOrEqual(
|
Assert::assertGreaterThanOrEqual(
|
||||||
$expectedHttpCode,
|
$expectedHttpCode,
|
||||||
$response->getStatusCode(),
|
$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(
|
public function publiclyUploadingIntoFolderWithPasswordShouldWork(
|
||||||
string $filename,
|
string $filename,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->publicUploadContent(
|
$response = $this->publicUploadContent(
|
||||||
$filename,
|
$filename,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
||||||
@@ -841,12 +841,12 @@ class PublicWebDavContext implements Context {
|
|||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
($response->getStatusCode() === 201),
|
($response->getStatusCode() === 201),
|
||||||
"upload should have passed but failed with code " .
|
"upload should have passed but failed with code " .
|
||||||
$response->getStatusCode()
|
$response->getStatusCode(),
|
||||||
);
|
);
|
||||||
$response = $this->downloadFileFromPublicFolder(
|
$response = $this->downloadFileFromPublicFolder(
|
||||||
$path,
|
$path,
|
||||||
$password,
|
$password,
|
||||||
""
|
"",
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
$this->featureContext->checkDownloadedContentMatches($content, "", $response);
|
$this->featureContext->checkDownloadedContentMatches($content, "", $response);
|
||||||
@@ -872,31 +872,31 @@ class PublicWebDavContext implements Context {
|
|||||||
$response = $this->publicUploadContent(
|
$response = $this->publicUploadContent(
|
||||||
$path,
|
$path,
|
||||||
$password,
|
$password,
|
||||||
$content
|
$content,
|
||||||
);
|
);
|
||||||
if ($should) {
|
if ($should) {
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
($response->getStatusCode() == 204),
|
($response->getStatusCode() == 204),
|
||||||
"upload should have passed but failed with code " .
|
"upload should have passed but failed with code " .
|
||||||
$response->getStatusCode()
|
$response->getStatusCode(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $this->downloadPublicFileWithRange(
|
$response = $this->downloadPublicFileWithRange(
|
||||||
"",
|
"",
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->featureContext->checkDownloadedContentMatches(
|
$this->featureContext->checkDownloadedContentMatches(
|
||||||
$content,
|
$content,
|
||||||
"Checking the content of the last public shared file after downloading with the public WebDAV API",
|
"Checking the content of the last public shared file after downloading with the public WebDAV API",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$expectedCode = 403;
|
$expectedCode = 403;
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
($response->getStatusCode() == $expectedCode),
|
($response->getStatusCode() == $expectedCode),
|
||||||
"upload should have failed with HTTP status $expectedCode but passed with code " .
|
"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,
|
string $destination,
|
||||||
): void {
|
): void {
|
||||||
$content = \file_get_contents(
|
$content = \file_get_contents(
|
||||||
$this->featureContext->acceptanceTestsDirLocation() . $source
|
$this->featureContext->acceptanceTestsDirLocation() . $source,
|
||||||
);
|
);
|
||||||
$response = $this->publicUploadContent(
|
$response = $this->publicUploadContent(
|
||||||
$destination,
|
$destination,
|
||||||
'',
|
'',
|
||||||
$content
|
$content,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -937,15 +937,15 @@ class PublicWebDavContext implements Context {
|
|||||||
public function thePublicUploadsFileToInsideLastLinkSharedFolderWithPasswordUsingThePublicWebdavApi(
|
public function thePublicUploadsFileToInsideLastLinkSharedFolderWithPasswordUsingThePublicWebdavApi(
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$content = \file_get_contents(
|
$content = \file_get_contents(
|
||||||
$this->featureContext->acceptanceTestsDirLocation() . $source
|
$this->featureContext->acceptanceTestsDirLocation() . $source,
|
||||||
);
|
);
|
||||||
$response = $this->publicUploadContent(
|
$response = $this->publicUploadContent(
|
||||||
$destination,
|
$destination,
|
||||||
$password,
|
$password,
|
||||||
$content
|
$content,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -963,7 +963,7 @@ class PublicWebDavContext implements Context {
|
|||||||
public function thePublicUploadsFileToLastSharedFolderWithMtimeUsingTheWebdavApi(
|
public function thePublicUploadsFileToLastSharedFolderWithMtimeUsingTheWebdavApi(
|
||||||
string $fileName,
|
string $fileName,
|
||||||
string $password,
|
string $password,
|
||||||
string $mtime
|
string $mtime,
|
||||||
): void {
|
): void {
|
||||||
$mtime = new DateTime($mtime);
|
$mtime = new DateTime($mtime);
|
||||||
$mtime = $mtime->format('U');
|
$mtime = $mtime->format('U');
|
||||||
@@ -973,7 +973,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$password,
|
$password,
|
||||||
'test',
|
'test',
|
||||||
false,
|
false,
|
||||||
["X-OC-Mtime" => $mtime]
|
["X-OC-Mtime" => $mtime],
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -986,7 +986,7 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function publicCreatesFolderUsingPassword(
|
public function publicCreatesFolderUsingPassword(
|
||||||
string $destination,
|
string $destination,
|
||||||
string $password
|
string $password,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$token = ($this->featureContext->isUsingSharingNG())
|
$token = ($this->featureContext->isUsingSharingNG())
|
||||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||||
@@ -994,17 +994,17 @@ class PublicWebDavContext implements Context {
|
|||||||
$davPath = WebDavHelper::getDavPath(
|
$davPath = WebDavHelper::getDavPath(
|
||||||
$this->featureContext->getDavPathVersion(),
|
$this->featureContext->getDavPathVersion(),
|
||||||
$token,
|
$token,
|
||||||
"public-files"
|
"public-files",
|
||||||
);
|
);
|
||||||
$url = $this->featureContext->getBaseUrl() . "/$davPath/";
|
$url = $this->featureContext->getBaseUrl() . "/$davPath/";
|
||||||
$password = $this->featureContext->getActualPassword($password);
|
$password = $this->featureContext->getActualPassword($password);
|
||||||
$userName = $this->getUsernameForPublicWebdavApi(
|
$userName = $this->getUsernameForPublicWebdavApi(
|
||||||
$token,
|
$token,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$foldername = \implode(
|
$foldername = \implode(
|
||||||
'/',
|
'/',
|
||||||
\array_map('rawurlencode', \explode('/', $destination))
|
\array_map('rawurlencode', \explode('/', $destination)),
|
||||||
);
|
);
|
||||||
$url .= \ltrim($foldername, '/');
|
$url .= \ltrim($foldername, '/');
|
||||||
|
|
||||||
@@ -1012,7 +1012,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$url,
|
$url,
|
||||||
'MKCOL',
|
'MKCOL',
|
||||||
$userName,
|
$userName,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1037,7 +1037,7 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function publicShouldBeAbleToCreateFolderWithPassword(
|
public function publicShouldBeAbleToCreateFolderWithPassword(
|
||||||
string $foldername,
|
string $foldername,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->publicCreatesFolderUsingPassword($foldername, $password);
|
$response = $this->publicCreatesFolderUsingPassword($foldername, $password);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response);
|
||||||
@@ -1055,14 +1055,14 @@ class PublicWebDavContext implements Context {
|
|||||||
public function publicCreationOfFolderWithPasswordShouldFail(
|
public function publicCreationOfFolderWithPasswordShouldFail(
|
||||||
string $foldername,
|
string $foldername,
|
||||||
string $password,
|
string $password,
|
||||||
string $expectedHttpCode
|
string $expectedHttpCode,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->publicCreatesFolderUsingPassword($foldername, $password);
|
$response = $this->publicCreatesFolderUsingPassword($foldername, $password);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
$expectedHttpCode,
|
$expectedHttpCode,
|
||||||
"creation of $foldername in the last publicly shared folder should have failed with code " .
|
"creation of $foldername in the last publicly shared folder should have failed with code " .
|
||||||
$expectedHttpCode,
|
$expectedHttpCode,
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1077,7 +1077,7 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldBe(
|
public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldBe(
|
||||||
string $fileName,
|
string $fileName,
|
||||||
string $mtime
|
string $mtime,
|
||||||
): void {
|
): void {
|
||||||
$token = ($this->featureContext->isUsingSharingNG())
|
$token = ($this->featureContext->isUsingSharingNG())
|
||||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||||
@@ -1092,7 +1092,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$baseUrl,
|
$baseUrl,
|
||||||
$fileName,
|
$fileName,
|
||||||
$token,
|
$token,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1107,7 +1107,7 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldNotBe(
|
public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldNotBe(
|
||||||
string $fileName,
|
string $fileName,
|
||||||
string $mtime
|
string $mtime,
|
||||||
): void {
|
): void {
|
||||||
$token = $this->featureContext->getLastCreatedPublicShareToken();
|
$token = $this->featureContext->getLastCreatedPublicShareToken();
|
||||||
$baseUrl = $this->featureContext->getBaseUrl();
|
$baseUrl = $this->featureContext->getBaseUrl();
|
||||||
@@ -1117,7 +1117,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$baseUrl,
|
$baseUrl,
|
||||||
$fileName,
|
$fileName,
|
||||||
$token,
|
$token,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1148,16 +1148,16 @@ class PublicWebDavContext implements Context {
|
|||||||
$davPath = WebDavHelper::getDavPath(
|
$davPath = WebDavHelper::getDavPath(
|
||||||
WebDavHelper::DAV_VERSION_NEW,
|
WebDavHelper::DAV_VERSION_NEW,
|
||||||
$token,
|
$token,
|
||||||
"public-files"
|
"public-files",
|
||||||
);
|
);
|
||||||
$userName = $this->getUsernameForPublicWebdavApi(
|
$userName = $this->getUsernameForPublicWebdavApi(
|
||||||
$token,
|
$token,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
|
|
||||||
$filename = \implode(
|
$filename = \implode(
|
||||||
'/',
|
'/',
|
||||||
\array_map('rawurlencode', \explode('/', $filename))
|
\array_map('rawurlencode', \explode('/', $filename)),
|
||||||
);
|
);
|
||||||
$encodedFilePath = \ltrim($filename, '/');
|
$encodedFilePath = \ltrim($filename, '/');
|
||||||
$url = $this->featureContext->getBaseUrl() . "/$davPath/$encodedFilePath";
|
$url = $this->featureContext->getBaseUrl() . "/$davPath/$encodedFilePath";
|
||||||
@@ -1176,7 +1176,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$userName,
|
$userName,
|
||||||
$password,
|
$password,
|
||||||
$headers,
|
$headers,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1188,7 +1188,7 @@ class PublicWebDavContext implements Context {
|
|||||||
*/
|
*/
|
||||||
private function getUsernameForPublicWebdavApi(
|
private function getUsernameForPublicWebdavApi(
|
||||||
string $token,
|
string $token,
|
||||||
string $password
|
string $password,
|
||||||
): ?string {
|
): ?string {
|
||||||
if ($password !== '') {
|
if ($password !== '') {
|
||||||
$userName = 'public';
|
$userName = 'public';
|
||||||
@@ -1243,12 +1243,12 @@ class PublicWebDavContext implements Context {
|
|||||||
$davPath = WebDavHelper::getDavPath(
|
$davPath = WebDavHelper::getDavPath(
|
||||||
WebDavHelper::DAV_VERSION_NEW,
|
WebDavHelper::DAV_VERSION_NEW,
|
||||||
$token,
|
$token,
|
||||||
"public-files"
|
"public-files",
|
||||||
);
|
);
|
||||||
$password = $this->featureContext->getActualPassword($password);
|
$password = $this->featureContext->getActualPassword($password);
|
||||||
$username = $this->getUsernameForPublicWebdavApi(
|
$username = $this->getUsernameForPublicWebdavApi(
|
||||||
$token,
|
$token,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath";
|
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath";
|
||||||
$response = HttpRequestHelper::sendRequest(
|
$response = HttpRequestHelper::sendRequest(
|
||||||
@@ -1257,7 +1257,7 @@ class PublicWebDavContext implements Context {
|
|||||||
$username,
|
$username,
|
||||||
$password,
|
$password,
|
||||||
null,
|
null,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class SearchContext implements Context {
|
|||||||
?string $scopeType = null,
|
?string $scopeType = null,
|
||||||
?string $scope = null,
|
?string $scope = null,
|
||||||
?string $spaceName = null,
|
?string $spaceName = null,
|
||||||
?TableNode $properties = null
|
?TableNode $properties = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$baseUrl = $this->featureContext->getBaseUrl();
|
$baseUrl = $this->featureContext->getBaseUrl();
|
||||||
@@ -87,7 +87,7 @@ class SearchContext implements Context {
|
|||||||
$resourceID = $this->featureContext->spacesContext->getResourceId(
|
$resourceID = $this->featureContext->spacesContext->getResourceId(
|
||||||
$user,
|
$user,
|
||||||
$spaceName ?? "Personal",
|
$spaceName ?? "Personal",
|
||||||
$scope
|
$scope,
|
||||||
);
|
);
|
||||||
$pattern .= " scope:$resourceID";
|
$pattern .= " scope:$resourceID";
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ class SearchContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
null,
|
null,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ class SearchContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $pattern,
|
string $pattern,
|
||||||
?string $limit = null,
|
?string $limit = null,
|
||||||
?TableNode $properties = null
|
?TableNode $properties = null,
|
||||||
): void {
|
): void {
|
||||||
// NOTE: because indexing of newly uploaded files or directories with ocis is decoupled and occurs asynchronously
|
// NOTE: because indexing of newly uploaded files or directories with ocis is decoupled and occurs asynchronously
|
||||||
// short wait is necessary before searching
|
// short wait is necessary before searching
|
||||||
@@ -166,28 +166,28 @@ class SearchContext implements Context {
|
|||||||
public function fileOrFolderInTheSearchResultShouldContainProperties(
|
public function fileOrFolderInTheSearchResultShouldContainProperties(
|
||||||
string $path,
|
string $path,
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$this->featureContext->verifyTableNodeColumns($properties, ['name', 'value']);
|
$this->featureContext->verifyTableNodeColumns($properties, ['name', 'value']);
|
||||||
$properties = $properties->getHash();
|
$properties = $properties->getHash();
|
||||||
$fileResult = $this->featureContext->findEntryFromSearchResponse(
|
$fileResult = $this->featureContext->findEntryFromSearchResponse(
|
||||||
$path
|
$path,
|
||||||
);
|
);
|
||||||
Assert::assertNotFalse(
|
Assert::assertNotFalse(
|
||||||
$fileResult,
|
$fileResult,
|
||||||
"could not find file/folder '$path'"
|
"could not find file/folder '$path'",
|
||||||
);
|
);
|
||||||
foreach ($properties as $property) {
|
foreach ($properties as $property) {
|
||||||
$property['value'] = $this->featureContext->substituteInLineCodes(
|
$property['value'] = $this->featureContext->substituteInLineCodes(
|
||||||
$property['value'],
|
$property['value'],
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
$fileResultProperty = $fileResult->xpath("d:propstat//" . $property['name']);
|
$fileResultProperty = $fileResult->xpath("d:propstat//" . $property['name']);
|
||||||
if ($fileResultProperty) {
|
if ($fileResultProperty) {
|
||||||
Assert::assertMatchesRegularExpression(
|
Assert::assertMatchesRegularExpression(
|
||||||
"/" . $property['value'] . "/",
|
"/" . $property['value'] . "/",
|
||||||
\trim((string)$fileResultProperty[0])
|
\trim((string)$fileResultProperty[0]),
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -224,13 +224,13 @@ class SearchContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theSearchResultShouldContainEntriesWithHighlight(
|
public function theSearchResultShouldContainEntriesWithHighlight(
|
||||||
TableNode $expectedFiles,
|
TableNode $expectedFiles,
|
||||||
string $expectedContent
|
string $expectedContent,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->verifyTableNodeColumnsCount($expectedFiles, 1);
|
$this->featureContext->verifyTableNodeColumnsCount($expectedFiles, 1);
|
||||||
$elementRows = $expectedFiles->getRows();
|
$elementRows = $expectedFiles->getRows();
|
||||||
$foundEntries = $this->featureContext->findEntryFromSearchResponse(
|
$foundEntries = $this->featureContext->findEntryFromSearchResponse(
|
||||||
null,
|
null,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
foreach ($elementRows as $expectedFile) {
|
foreach ($elementRows as $expectedFile) {
|
||||||
$filename = $expectedFile[0];
|
$filename = $expectedFile[0];
|
||||||
@@ -244,7 +244,7 @@ class SearchContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$expectedContent,
|
$expectedContent,
|
||||||
$actualContent,
|
$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(
|
return SettingsHelper::getRolesList(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user)
|
$this->featureContext->getPasswordForUser($user),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ class SettingsContext implements Context {
|
|||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
201,
|
201,
|
||||||
"Expected response status code should be 201",
|
"Expected response status code should be 201",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,12 +150,12 @@ class SettingsContext implements Context {
|
|||||||
public function userAssignsTheRoleToUserUsingTheSettingsApi(
|
public function userAssignsTheRoleToUserUsingTheSettingsApi(
|
||||||
string $assigner,
|
string $assigner,
|
||||||
string $role,
|
string $role,
|
||||||
string $assignee
|
string $assignee,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->assignRoleToUser(
|
$response = $this->assignRoleToUser(
|
||||||
$assigner,
|
$assigner,
|
||||||
$this->featureContext->getAttributeOfCreatedUser($assignee, 'id'),
|
$this->featureContext->getAttributeOfCreatedUser($assignee, 'id'),
|
||||||
$this->getRoleIdByRoleName($assigner, $role)
|
$this->getRoleIdByRoleName($assigner, $role),
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ class SettingsContext implements Context {
|
|||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
201,
|
201,
|
||||||
"Expected response status code should be 201",
|
"Expected response status code should be 201",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
|
|
||||||
$rawBody = $response->getBody()->getContents();
|
$rawBody = $response->getBody()->getContents();
|
||||||
@@ -201,7 +201,7 @@ class SettingsContext implements Context {
|
|||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
'bundles',
|
'bundles',
|
||||||
$decodedBody,
|
$decodedBody,
|
||||||
__METHOD__ . " could not find bundles in body"
|
__METHOD__ . " could not find bundles in body",
|
||||||
);
|
);
|
||||||
$bundles = $decodedBody["bundles"];
|
$bundles = $decodedBody["bundles"];
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ class SettingsContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role),
|
$this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role),
|
||||||
$actualRoleId,
|
$actualRoleId,
|
||||||
"user $user has no role $role"
|
"user $user has no role $role",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Assert::fail("Response should contain user role but not found.\n" . json_encode($assignmentResponse));
|
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 {
|
public function theSettingApiResponseShouldHaveTheRole(string $role): void {
|
||||||
$assignmentRoleId = $this->featureContext->getJsonDecodedResponse(
|
$assignmentRoleId = $this->featureContext->getJsonDecodedResponse(
|
||||||
$this->featureContext->getResponse()
|
$this->featureContext->getResponse(),
|
||||||
)["assignments"][0]["roleId"];
|
)["assignments"][0]["roleId"];
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role),
|
$this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role),
|
||||||
$assignmentRoleId,
|
$assignmentRoleId,
|
||||||
"user has no role $role"
|
"user has no role $role",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ class SettingsContext implements Context {
|
|||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ class SettingsContext implements Context {
|
|||||||
public function theUserListsAllValuesListWithHeadersUsingSettingsApi(string $user, TableNode $headersTable): void {
|
public function theUserListsAllValuesListWithHeadersUsingSettingsApi(string $user, TableNode $headersTable): void {
|
||||||
$this->featureContext->verifyTableNodeColumns(
|
$this->featureContext->verifyTableNodeColumns(
|
||||||
$headersTable,
|
$headersTable,
|
||||||
['header', 'value']
|
['header', 'value'],
|
||||||
);
|
);
|
||||||
$headers = [];
|
$headers = [];
|
||||||
foreach ($headersTable as $row) {
|
foreach ($headersTable as $row) {
|
||||||
@@ -431,7 +431,7 @@ class SettingsContext implements Context {
|
|||||||
"settingId" => $settingId,
|
"settingId" => $settingId,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
JSON_THROW_ON_ERROR
|
JSON_THROW_ON_ERROR,
|
||||||
);
|
);
|
||||||
return SettingsHelper::updateSettings(
|
return SettingsHelper::updateSettings(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
@@ -457,7 +457,7 @@ class SettingsContext implements Context {
|
|||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
201,
|
201,
|
||||||
"Expected response status code should be 201",
|
"Expected response status code should be 201",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,7 +499,7 @@ class SettingsContext implements Context {
|
|||||||
"boolValue" => $status,
|
"boolValue" => $status,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
JSON_THROW_ON_ERROR
|
JSON_THROW_ON_ERROR,
|
||||||
);
|
);
|
||||||
|
|
||||||
return SettingsHelper::updateSettings(
|
return SettingsHelper::updateSettings(
|
||||||
@@ -526,7 +526,7 @@ class SettingsContext implements Context {
|
|||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
201,
|
201,
|
||||||
"Expected response status code should be 201",
|
"Expected response status code should be 201",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
$this->featureContext->rememberUserAutoSyncSetting($user, false);
|
$this->featureContext->rememberUserAutoSyncSetting($user, false);
|
||||||
}
|
}
|
||||||
@@ -590,7 +590,7 @@ class SettingsContext implements Context {
|
|||||||
public function enableOrDisableNotification(
|
public function enableOrDisableNotification(
|
||||||
string $user,
|
string $user,
|
||||||
string $enableOrDisable,
|
string $enableOrDisable,
|
||||||
array $event
|
array $event,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$body = [
|
$body = [
|
||||||
"value" => [
|
"value" => [
|
||||||
@@ -638,7 +638,7 @@ class SettingsContext implements Context {
|
|||||||
public function userHasEnabledOrDisabledNotificationForTheFollowingEventUsingTheSettingsApi(
|
public function userHasEnabledOrDisabledNotificationForTheFollowingEventUsingTheSettingsApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $enableOrDisable,
|
string $enableOrDisable,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$event = $table->getRowsHash();
|
$event = $table->getRowsHash();
|
||||||
$response = $this->enableOrDisableNotification($user, $enableOrDisable, $event);
|
$response = $this->enableOrDisableNotification($user, $enableOrDisable, $event);
|
||||||
@@ -657,7 +657,7 @@ class SettingsContext implements Context {
|
|||||||
public function userEnablesOrDisablesNotificationForTheFollowingEventUsingTheSettingsApi(
|
public function userEnablesOrDisablesNotificationForTheFollowingEventUsingTheSettingsApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $enableOrDisable,
|
string $enableOrDisable,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$event = $table->getRowsHash();
|
$event = $table->getRowsHash();
|
||||||
$response = $this->enableOrDisableNotification($user, $enableOrDisable, $event);
|
$response = $this->enableOrDisableNotification($user, $enableOrDisable, $event);
|
||||||
@@ -757,14 +757,14 @@ class SettingsContext implements Context {
|
|||||||
Assert::fail(
|
Assert::fail(
|
||||||
"Setting '$settingName' does not have a stringValue, boolValue or listValue."
|
"Setting '$settingName' does not have a stringValue, boolValue or listValue."
|
||||||
. "\n"
|
. "\n"
|
||||||
. json_encode($setting)
|
. json_encode($setting),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$value,
|
$value,
|
||||||
$settingValue,
|
$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->featureContext->setResponse(
|
||||||
$this->getShareesWithParameters(
|
$this->getShareesWithParameters(
|
||||||
$this->featureContext->getCurrentUser(),
|
$this->featureContext->getCurrentUser(),
|
||||||
$body
|
$body,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,8 +67,8 @@ class ShareesContext implements Context {
|
|||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->getShareesWithParameters(
|
$this->getShareesWithParameters(
|
||||||
$user,
|
$user,
|
||||||
$body
|
$body,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,12 +86,12 @@ class ShareesContext implements Context {
|
|||||||
$sharees = $shareesList->getRows();
|
$sharees = $shareesList->getRows();
|
||||||
$respondedArray = $this->getArrayOfShareesResponded(
|
$respondedArray = $this->getArrayOfShareesResponded(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
$shareeType
|
$shareeType,
|
||||||
);
|
);
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$sharees,
|
$sharees,
|
||||||
$respondedArray,
|
$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();
|
$sharees = $shareesList->getRows();
|
||||||
$respondedArray = $this->getArrayOfShareesResponded(
|
$respondedArray = $this->getArrayOfShareesResponded(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
$shareeType
|
$shareeType,
|
||||||
);
|
);
|
||||||
foreach ($sharees as $sharee) {
|
foreach ($sharees as $sharee) {
|
||||||
Assert::assertContains(
|
Assert::assertContains(
|
||||||
$sharee,
|
$sharee,
|
||||||
$respondedArray,
|
$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 {
|
public function theShareesReturnedShouldBeEmpty(string $shareeType): void {
|
||||||
$respondedArray = $this->getArrayOfShareesResponded(
|
$respondedArray = $this->getArrayOfShareesResponded(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
$shareeType
|
$shareeType,
|
||||||
);
|
);
|
||||||
if (isset($respondedArray[0])) {
|
if (isset($respondedArray[0])) {
|
||||||
// [0] is display name and [2] is user or group id
|
// [0] is display name and [2] is user or group id
|
||||||
@@ -141,7 +141,7 @@ class ShareesContext implements Context {
|
|||||||
|
|
||||||
Assert::assertEmpty(
|
Assert::assertEmpty(
|
||||||
$respondedArray,
|
$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(
|
public function getArrayOfShareesResponded(
|
||||||
ResponseInterface $response,
|
ResponseInterface $response,
|
||||||
string $shareeType
|
string $shareeType,
|
||||||
): array {
|
): array {
|
||||||
$elements = HttpRequestHelper::getResponseXml($response, __METHOD__)->data;
|
$elements = HttpRequestHelper::getResponseXml($response, __METHOD__)->data;
|
||||||
$elements = \json_decode(\json_encode($elements), true);
|
$elements = \json_decode(\json_encode($elements), true);
|
||||||
@@ -166,7 +166,7 @@ class ShareesContext implements Context {
|
|||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
$shareeType,
|
$shareeType,
|
||||||
$elements,
|
$elements,
|
||||||
__METHOD__ . " The sharees response does not have key '$shareeType'"
|
__METHOD__ . " The sharees response does not have key '$shareeType'",
|
||||||
);
|
);
|
||||||
|
|
||||||
$sharees = [];
|
$sharees = [];
|
||||||
@@ -215,7 +215,7 @@ class ShareesContext implements Context {
|
|||||||
return $this->ocsContext->sendRequestToOcsEndpoint(
|
return $this->ocsContext->sendRequestToOcsEndpoint(
|
||||||
$user,
|
$user,
|
||||||
'GET',
|
'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),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$itemId,
|
$itemId,
|
||||||
\json_encode($body)
|
\json_encode($body),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($response->getStatusCode() == 200) {
|
if ($response->getStatusCode() == 200) {
|
||||||
@@ -146,7 +146,7 @@ class SharingNgContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
\json_encode($body)
|
\json_encode($body),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ class SharingNgContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $space,
|
string $space,
|
||||||
?string $resource = '',
|
?string $resource = '',
|
||||||
?string $query = null
|
?string $query = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
if ($space === "Shares") {
|
if ($space === "Shares") {
|
||||||
$spaceId = $this->spacesContext->getSharesRemoteItemParentDriveId($user, $resource);
|
$spaceId = $this->spacesContext->getSharesRemoteItemParentDriveId($user, $resource);
|
||||||
@@ -179,7 +179,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$itemId,
|
$itemId,
|
||||||
$query
|
$query,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,10 +196,10 @@ class SharingNgContext implements Context {
|
|||||||
public function userGetsPermissionsListForResourceOfTheSpaceUsingTheGraphAPI(
|
public function userGetsPermissionsListForResourceOfTheSpaceUsingTheGraphAPI(
|
||||||
string $user,
|
string $user,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->getPermissionsList($user, $space, $resource)
|
$this->getPermissionsList($user, $space, $resource),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ class SharingNgContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space,
|
string $space,
|
||||||
string $shareMethods
|
string $shareMethods,
|
||||||
): void {
|
): void {
|
||||||
if ($shareMethods === 'link') {
|
if ($shareMethods === 'link') {
|
||||||
$permissionId = $this->featureContext->shareNgGetLastCreatedLinkShareID();
|
$permissionId = $this->featureContext->shareNgGetLastCreatedLinkShareID();
|
||||||
@@ -234,7 +234,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$itemId,
|
$itemId,
|
||||||
$permissionId
|
$permissionId,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -259,8 +259,8 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$itemId,
|
$itemId,
|
||||||
null
|
null,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ class SharingNgContext implements Context {
|
|||||||
public function userTriesToListThePermissionsOfSpaceUsingPermissionsEndpointOfTheGraphApi(
|
public function userTriesToListThePermissionsOfSpaceUsingPermissionsEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $space,
|
string $space,
|
||||||
string $spaceOwner
|
string $spaceOwner,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
|
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
|
||||||
$itemId = $this->spacesContext->getResourceId($spaceOwner, $space, '');
|
$itemId = $this->spacesContext->getResourceId($spaceOwner, $space, '');
|
||||||
@@ -288,8 +288,8 @@ class SharingNgContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$itemId
|
$itemId,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ class SharingNgContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
array $shareInfo,
|
array $shareInfo,
|
||||||
string $fileId = null,
|
string $fileId = null,
|
||||||
bool $federatedShare = false
|
bool $federatedShare = false,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$space = $this->spacesContext->getSpaceByName($user, $shareInfo['space']);
|
$space = $this->spacesContext->getSpaceByName($user, $shareInfo['space']);
|
||||||
$spaceId = $space['id'];
|
$spaceId = $space['id'];
|
||||||
@@ -348,7 +348,7 @@ class SharingNgContext implements Context {
|
|||||||
$shareeId = (
|
$shareeId = (
|
||||||
$this->featureContext->ocmContext->getAcceptedUserByName(
|
$this->featureContext->ocmContext->getAcceptedUserByName(
|
||||||
$user,
|
$user,
|
||||||
$sharee
|
$sharee,
|
||||||
)
|
)
|
||||||
)['user_id'];
|
)['user_id'];
|
||||||
}
|
}
|
||||||
@@ -374,7 +374,7 @@ class SharingNgContext implements Context {
|
|||||||
$shareTypes,
|
$shareTypes,
|
||||||
$permissionsRole,
|
$permissionsRole,
|
||||||
$permissionsAction,
|
$permissionsAction,
|
||||||
$expirationDateTime
|
$expirationDateTime,
|
||||||
);
|
);
|
||||||
if ($response->getStatusCode() === 200) {
|
if ($response->getStatusCode() === 200) {
|
||||||
$this->featureContext->shareNgAddToCreatedUserGroupShares($response);
|
$this->featureContext->shareNgAddToCreatedUserGroupShares($response);
|
||||||
@@ -398,7 +398,7 @@ class SharingNgContext implements Context {
|
|||||||
public function sendDriveShareInvitation(
|
public function sendDriveShareInvitation(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table,
|
TableNode $table,
|
||||||
bool $federatedShare = false
|
bool $federatedShare = false,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$shareeIds = [];
|
$shareeIds = [];
|
||||||
$rows = $table->getRowsHash();
|
$rows = $table->getRowsHash();
|
||||||
@@ -441,7 +441,7 @@ class SharingNgContext implements Context {
|
|||||||
$shareTypes,
|
$shareTypes,
|
||||||
$permissionsRole,
|
$permissionsRole,
|
||||||
$permissionsAction,
|
$permissionsAction,
|
||||||
$expirationDateTime
|
$expirationDateTime,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,7 +460,7 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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);
|
$response = $this->sendShareInvitation($user, $rows);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
@@ -478,13 +478,13 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userHasSentTheFollowingResourceShareInvitationToFederatedUser(
|
public function userHasSentTheFollowingResourceShareInvitationToFederatedUser(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$rows = $table->getRowsHash();
|
$rows = $table->getRowsHash();
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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);
|
$response = $this->sendShareInvitation($user, $rows, null, true);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
@@ -505,7 +505,7 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertArrayNotHasKey(
|
Assert::assertArrayNotHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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);
|
$response = $this->sendDriveShareInvitation($user, $table);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
@@ -527,10 +527,10 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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->featureContext->setResponse(
|
||||||
$this->sendShareInvitation($user, $rows)
|
$this->sendShareInvitation($user, $rows),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,16 +546,16 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userSendsTheFollowingResourceShareInvitationToFederatedUserUsingTheGraphApi(
|
public function userSendsTheFollowingResourceShareInvitationToFederatedUserUsingTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$rows = $table->getRowsHash();
|
$rows = $table->getRowsHash();
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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->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(
|
public function userSendsTheFollowingResourcesShareInvitationConcurrentlyToFederatedUserUsingTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$results = $this->sendConcurrentShareInvitation($user, $table);
|
$results = $this->sendConcurrentShareInvitation($user, $table);
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
@@ -597,7 +597,7 @@ class SharingNgContext implements Context {
|
|||||||
$shareeId = (
|
$shareeId = (
|
||||||
$this->featureContext->ocmContext->getAcceptedUserByName(
|
$this->featureContext->ocmContext->getAcceptedUserByName(
|
||||||
$user,
|
$user,
|
||||||
$shareInfo["sharee"]
|
$shareInfo["sharee"],
|
||||||
)
|
)
|
||||||
)['user_id'];
|
)['user_id'];
|
||||||
|
|
||||||
@@ -614,21 +614,21 @@ class SharingNgContext implements Context {
|
|||||||
|
|
||||||
$fullUrl = GraphHelper::getBetaFullUrl(
|
$fullUrl = GraphHelper::getBetaFullUrl(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
"drives/$spaceId/items/$itemId/invite"
|
"drives/$spaceId/items/$itemId/invite",
|
||||||
);
|
);
|
||||||
|
|
||||||
$request = HttpRequestHelper::createRequest(
|
$request = HttpRequestHelper::createRequest(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
"POST",
|
"POST",
|
||||||
['Content-Type' => 'application/json'],
|
['Content-Type' => 'application/json'],
|
||||||
\json_encode($body)
|
\json_encode($body),
|
||||||
);
|
);
|
||||||
$requests[] = $request;
|
$requests[] = $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
$client = HttpRequestHelper::createClient(
|
$client = HttpRequestHelper::createClient(
|
||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user)
|
$this->featureContext->getPasswordForUser($user),
|
||||||
);
|
);
|
||||||
|
|
||||||
return HttpRequestHelper::sendBatchRequest($requests, $client);
|
return HttpRequestHelper::sendBatchRequest($requests, $client);
|
||||||
@@ -646,16 +646,16 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userSendsTheFollowingSpaceShareInvitationUsingPermissionsEndpointOfTheGraphApi(
|
public function userSendsTheFollowingSpaceShareInvitationUsingPermissionsEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$rows = $table->getRowsHash();
|
$rows = $table->getRowsHash();
|
||||||
Assert::assertArrayNotHasKey(
|
Assert::assertArrayNotHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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->featureContext->setResponse(
|
||||||
$this->sendShareInvitation($user, $rows)
|
$this->sendShareInvitation($user, $rows),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,16 +671,16 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userSendsTheFollowingSpaceShareInvitationToFederatedUserUsingPermissionsEndpointOfTheGraphApi(
|
public function userSendsTheFollowingSpaceShareInvitationToFederatedUserUsingPermissionsEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$rows = $table->getRowsHash();
|
$rows = $table->getRowsHash();
|
||||||
Assert::assertArrayNotHasKey(
|
Assert::assertArrayNotHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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->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(
|
$response = $this->updateResourceShare(
|
||||||
$user,
|
$user,
|
||||||
$table,
|
$table,
|
||||||
$permissionID
|
$permissionID,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Expected response status code should be 200", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Expected response status code should be 200", $response);
|
||||||
}
|
}
|
||||||
@@ -716,8 +716,8 @@ class SharingNgContext implements Context {
|
|||||||
$this->updateResourceShare(
|
$this->updateResourceShare(
|
||||||
$user,
|
$user,
|
||||||
$table,
|
$table,
|
||||||
$permissionID
|
$permissionID,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -735,7 +735,7 @@ class SharingNgContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $shareType,
|
string $shareType,
|
||||||
string $sharee,
|
string $sharee,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$permissionID = "";
|
$permissionID = "";
|
||||||
if ($shareType === "user") {
|
if ($shareType === "user") {
|
||||||
@@ -748,8 +748,8 @@ class SharingNgContext implements Context {
|
|||||||
$this->updateResourceShare(
|
$this->updateResourceShare(
|
||||||
$user,
|
$user,
|
||||||
$table,
|
$table,
|
||||||
$permissionID
|
$permissionID,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,7 +788,7 @@ class SharingNgContext implements Context {
|
|||||||
$spaceId,
|
$spaceId,
|
||||||
$itemId,
|
$itemId,
|
||||||
\json_encode($body),
|
\json_encode($body),
|
||||||
$permissionID
|
$permissionID,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($response->getStatusCode() === 200) {
|
if ($response->getStatusCode() === 200) {
|
||||||
@@ -812,11 +812,11 @@ class SharingNgContext implements Context {
|
|||||||
public function userSendsTheFollowingShareInvitationWithFileIdUsingTheGraphApi(
|
public function userSendsTheFollowingShareInvitationWithFileIdUsingTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $fileId,
|
string $fileId,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$rows = $table->getRowsHash();
|
$rows = $table->getRowsHash();
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->sendShareInvitation($user, $rows, $fileId)
|
$this->sendShareInvitation($user, $rows, $fileId),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -845,7 +845,7 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userCreatesTheFollowingSpaceLinkShareUsingPermissionsEndpointOfTheGraphApi(
|
public function userCreatesTheFollowingSpaceLinkShareUsingPermissionsEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $body
|
TableNode $body,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse($this->createLinkShare($user, $body));
|
$this->featureContext->setResponse($this->createLinkShare($user, $body));
|
||||||
}
|
}
|
||||||
@@ -861,7 +861,7 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userHasCreatedTheFollowingSpaceLinkShareUsingPermissionsEndpointOfTheGraphApi(
|
public function userHasCreatedTheFollowingSpaceLinkShareUsingPermissionsEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $body
|
TableNode $body,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->createLinkShare($user, $body);
|
$response = $this->createLinkShare($user, $body);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
|
||||||
@@ -881,7 +881,7 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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);
|
$response = $this->createLinkShare($user, $body);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
|
||||||
@@ -901,7 +901,7 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertArrayNotHasKey(
|
Assert::assertArrayNotHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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);
|
$response = $this->createDriveLinkShare($user, $body);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
|
||||||
@@ -921,7 +921,7 @@ class SharingNgContext implements Context {
|
|||||||
$response = $this->updateLinkShare(
|
$response = $this->updateLinkShare(
|
||||||
$user,
|
$user,
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while updating public share link!", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while updating public share link!", $response);
|
||||||
}
|
}
|
||||||
@@ -937,14 +937,14 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userUpdatesTheLastPublicLinkShareUsingThePermissionsEndpointOfTheGraphApi(
|
public function userUpdatesTheLastPublicLinkShareUsingThePermissionsEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $body
|
TableNode $body,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->updateLinkShare(
|
$this->updateLinkShare(
|
||||||
$user,
|
$user,
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -987,7 +987,7 @@ class SharingNgContext implements Context {
|
|||||||
$spaceId,
|
$spaceId,
|
||||||
$itemId,
|
$itemId,
|
||||||
\json_encode($body),
|
\json_encode($body),
|
||||||
$permissionID
|
$permissionID,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($response->getStatusCode() === 200) {
|
if ($response->getStatusCode() === 200) {
|
||||||
@@ -1027,7 +1027,7 @@ class SharingNgContext implements Context {
|
|||||||
$spaceId,
|
$spaceId,
|
||||||
$itemId,
|
$itemId,
|
||||||
\json_encode($body),
|
\json_encode($body),
|
||||||
$permissionID
|
$permissionID,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($response->getStatusCode() === 200) {
|
if ($response->getStatusCode() === 200) {
|
||||||
@@ -1049,12 +1049,12 @@ class SharingNgContext implements Context {
|
|||||||
$response = $this->setLinkSharePassword(
|
$response = $this->setLinkSharePassword(
|
||||||
$user,
|
$user,
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
200,
|
200,
|
||||||
"Failed while setting public share link password!",
|
"Failed while setting public share link password!",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1069,14 +1069,14 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userSetsOrUpdatesFollowingPasswordForLastLinkShareUsingTheGraphApi(
|
public function userSetsOrUpdatesFollowingPasswordForLastLinkShareUsingTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $body
|
TableNode $body,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->setLinkSharePassword(
|
$this->setLinkSharePassword(
|
||||||
$user,
|
$user,
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1098,7 +1098,7 @@ class SharingNgContext implements Context {
|
|||||||
string $shareType,
|
string $shareType,
|
||||||
string $space,
|
string $space,
|
||||||
?string $resource = null,
|
?string $resource = null,
|
||||||
?string $recipient = null
|
?string $recipient = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$spaceId = ($this->spacesContext->getSpaceByName($sharer, $space))["id"];
|
$spaceId = ($this->spacesContext->getSpaceByName($sharer, $space))["id"];
|
||||||
$itemId = (isset($resource)) ? $this->spacesContext->getResourceId($sharer, $space, $resource)
|
$itemId = (isset($resource)) ? $this->spacesContext->getResourceId($sharer, $space, $resource)
|
||||||
@@ -1128,7 +1128,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getPasswordForUser($sharer),
|
$this->featureContext->getPasswordForUser($sharer),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$itemId,
|
$itemId,
|
||||||
$permissionID
|
$permissionID,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1148,7 +1148,7 @@ class SharingNgContext implements Context {
|
|||||||
string $sharer,
|
string $sharer,
|
||||||
string $shareType,
|
string $shareType,
|
||||||
string $space,
|
string $space,
|
||||||
?string $recipient = null
|
?string $recipient = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$spaceId = ($this->spacesContext->getSpaceByName($sharer, $space))["id"];
|
$spaceId = ($this->spacesContext->getSpaceByName($sharer, $space))["id"];
|
||||||
|
|
||||||
@@ -1165,7 +1165,7 @@ class SharingNgContext implements Context {
|
|||||||
$sharer,
|
$sharer,
|
||||||
$this->featureContext->getPasswordForUser($sharer),
|
$this->featureContext->getPasswordForUser($sharer),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$permissionID
|
$permissionID,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1187,7 +1187,7 @@ class SharingNgContext implements Context {
|
|||||||
string $recipientType,
|
string $recipientType,
|
||||||
string $recipient,
|
string $recipient,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->removeAccessToSpaceItem($sharer, $recipientType, $space, $resource);
|
$response = $this->removeAccessToSpaceItem($sharer, $recipientType, $space, $resource);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||||
@@ -1211,10 +1211,10 @@ class SharingNgContext implements Context {
|
|||||||
string $recipientType,
|
string $recipientType,
|
||||||
string $recipient,
|
string $recipient,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$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 $sharer,
|
||||||
string $recipientType,
|
string $recipientType,
|
||||||
string $recipient,
|
string $recipient,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$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(
|
public function userHasRemovedTheLastLinkShareOfFileOrFolderFromSpace(
|
||||||
string $sharer,
|
string $sharer,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->removeAccessToSpaceItem($sharer, 'link', $space, $resource);
|
$response = $this->removeAccessToSpaceItem($sharer, 'link', $space, $resource);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||||
@@ -1275,10 +1275,10 @@ class SharingNgContext implements Context {
|
|||||||
public function userRemovesSharePermissionOfAResourceInLinkShareUsingGraphAPI(
|
public function userRemovesSharePermissionOfAResourceInLinkShareUsingGraphAPI(
|
||||||
string $sharer,
|
string $sharer,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$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 $sharer,
|
||||||
string $recipientType,
|
string $recipientType,
|
||||||
string $recipient,
|
string $recipient,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$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(
|
public function userRemovesLinkFromSpaceUsingRootEndpointOfGraphAPI(
|
||||||
string $sharer,
|
string $sharer,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->removeAccessToSpace($sharer, 'link', $space)
|
$this->removeAccessToSpace($sharer, 'link', $space),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1341,7 +1341,7 @@ class SharingNgContext implements Context {
|
|||||||
string $sharer,
|
string $sharer,
|
||||||
string $recipientType,
|
string $recipientType,
|
||||||
string $recipient,
|
string $recipient,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->removeAccessToSpace($sharer, $recipientType, $space, $recipient);
|
$response = $this->removeAccessToSpace($sharer, $recipientType, $space, $recipient);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||||
@@ -1361,7 +1361,7 @@ class SharingNgContext implements Context {
|
|||||||
string $sharee,
|
string $sharee,
|
||||||
string $shareID,
|
string $shareID,
|
||||||
bool $hide = true,
|
bool $hide = true,
|
||||||
bool $federatedShare = false
|
bool $federatedShare = false,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$shareSpaceId = GraphHelper::SHARES_SPACE_ID;
|
$shareSpaceId = GraphHelper::SHARES_SPACE_ID;
|
||||||
if ($federatedShare) {
|
if ($federatedShare) {
|
||||||
@@ -1376,7 +1376,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getPasswordForUser($sharee),
|
$this->featureContext->getPasswordForUser($sharee),
|
||||||
$itemId,
|
$itemId,
|
||||||
$shareSpaceId,
|
$shareSpaceId,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1402,7 +1402,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
204,
|
204,
|
||||||
__METHOD__ . " could not disable sync of last share",
|
__METHOD__ . " could not disable sync of last share",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1508,7 +1508,7 @@ class SharingNgContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $share,
|
string $share,
|
||||||
string $offeredBy,
|
string $offeredBy,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$share = ltrim($share, '/');
|
$share = ltrim($share, '/');
|
||||||
$itemId = $this->spacesContext->getResourceId($offeredBy, $space, $share);
|
$itemId = $this->spacesContext->getResourceId($offeredBy, $space, $share);
|
||||||
@@ -1518,7 +1518,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$itemId,
|
$itemId,
|
||||||
$shareSpaceId
|
$shareSpaceId,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -1542,7 +1542,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$remoteItemId,
|
$remoteItemId,
|
||||||
GraphHelper::SHARES_SPACE_ID
|
GraphHelper::SHARES_SPACE_ID,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -1568,7 +1568,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$itemId,
|
$itemId,
|
||||||
$shareSpaceId
|
$shareSpaceId,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -1591,7 +1591,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$itemId,
|
$itemId,
|
||||||
$shareSpaceId
|
$shareSpaceId,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -1608,7 +1608,7 @@ class SharingNgContext implements Context {
|
|||||||
$response = GraphHelper::getSharesSharedWithMe(
|
$response = GraphHelper::getSharesSharedWithMe(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user)
|
$this->featureContext->getPasswordForUser($user),
|
||||||
);
|
);
|
||||||
|
|
||||||
$shares = $this->featureContext->getJsonDecodedResponse($response)["value"];
|
$shares = $this->featureContext->getJsonDecodedResponse($response)["value"];
|
||||||
@@ -1694,18 +1694,18 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userShouldBeAbleToSendShareTheFollowingInvitationWithAllAllowedPermissionRoles(
|
public function userShouldBeAbleToSendShareTheFollowingInvitationWithAllAllowedPermissionRoles(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$listPermissionResponse = $this->featureContext->getJsonDecodedResponseBodyContent();
|
$listPermissionResponse = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||||
if (!isset($listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'})) {
|
if (!isset($listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'})) {
|
||||||
Assert::fail(
|
Assert::fail(
|
||||||
"The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n"
|
"The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n"
|
||||||
. $listPermissionResponse
|
. $listPermissionResponse,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Assert::assertNotEmpty(
|
Assert::assertNotEmpty(
|
||||||
$listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'},
|
$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'};
|
$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
|
// 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);
|
$roleAllowed = GraphHelper::getPermissionNameByPermissionRoleId($role->id);
|
||||||
$responseSendInvitation = $this->sendShareInvitation(
|
$responseSendInvitation = $this->sendShareInvitation(
|
||||||
$user,
|
$user,
|
||||||
array_merge($rows, ['permissionsRole' => $roleAllowed])
|
array_merge($rows, ['permissionsRole' => $roleAllowed]),
|
||||||
);
|
);
|
||||||
$jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent(
|
$jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent(
|
||||||
$responseSendInvitation
|
$responseSendInvitation,
|
||||||
);
|
);
|
||||||
$httpsStatusCode = $responseSendInvitation->getStatusCode();
|
$httpsStatusCode = $responseSendInvitation->getStatusCode();
|
||||||
if ($httpsStatusCode === 200 && !empty($jsonResponseSendInvitation->value)) {
|
if ($httpsStatusCode === 200 && !empty($jsonResponseSendInvitation->value)) {
|
||||||
@@ -1760,7 +1760,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId
|
$spaceId,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -1785,7 +1785,7 @@ class SharingNgContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$permissionID
|
$permissionID,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -1803,7 +1803,7 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userListsPermissionOfSpaceSharedViaLinkUsingRootEndpointGraphApi(
|
public function userListsPermissionOfSpaceSharedViaLinkUsingRootEndpointGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"];
|
$spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"];
|
||||||
$permissionId = $this->featureContext->shareNgGetLastCreatedLinkShareID();
|
$permissionId = $this->featureContext->shareNgGetLastCreatedLinkShareID();
|
||||||
@@ -1812,7 +1812,7 @@ class SharingNgContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$permissionId
|
$permissionId,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -1828,7 +1828,7 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userSendsTheFollowingShareInvitationUsingRootEndPointTheGraphApi(
|
public function userSendsTheFollowingShareInvitationUsingRootEndPointTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->sendDriveShareInvitation($user, $table);
|
$response = $this->sendDriveShareInvitation($user, $table);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -1845,7 +1845,7 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userSendsTheFollowingShareInvitationToFederatedUserUsingRootEndPointTheGraphApi(
|
public function userSendsTheFollowingShareInvitationToFederatedUserUsingRootEndPointTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->sendDriveShareInvitation($user, $table, true);
|
$response = $this->sendDriveShareInvitation($user, $table, true);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -1862,7 +1862,7 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userUpdatesTheLastDriveShareWithTheFollowingUsingRootEndpointOfTheGraphApi(
|
public function userUpdatesTheLastDriveShareWithTheFollowingUsingRootEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$bodyRows = $table->getRowsHash();
|
$bodyRows = $table->getRowsHash();
|
||||||
$permissionID = match ($bodyRows['shareType']) {
|
$permissionID = match ($bodyRows['shareType']) {
|
||||||
@@ -1890,8 +1890,8 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
\json_encode($body),
|
\json_encode($body),
|
||||||
$permissionID
|
$permissionID,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1906,13 +1906,13 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userCreatesTheFollowingSpaceLinkShareUsingRootEndpointOfTheGraphApi(
|
public function userCreatesTheFollowingSpaceLinkShareUsingRootEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $body
|
TableNode $body,
|
||||||
): void {
|
): void {
|
||||||
$rows = $body->getRowsHash();
|
$rows = $body->getRowsHash();
|
||||||
Assert::assertArrayNotHasKey(
|
Assert::assertArrayNotHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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);
|
$response = $this->createDriveLinkShare($user, $body);
|
||||||
|
|
||||||
@@ -1930,13 +1930,13 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userSetsTheFollowingPasswordForTheLastSpaceLinkShareUsingRootEndpointOfTheGraphAPI(
|
public function userSetsTheFollowingPasswordForTheLastSpaceLinkShareUsingRootEndpointOfTheGraphAPI(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $body
|
TableNode $body,
|
||||||
): void {
|
): void {
|
||||||
$rows = $body->getRowsHash();
|
$rows = $body->getRowsHash();
|
||||||
Assert::assertArrayNotHasKey(
|
Assert::assertArrayNotHasKey(
|
||||||
"resource",
|
"resource",
|
||||||
$rows,
|
$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");
|
Assert::assertArrayHasKey("password", $rows, "'password' is missing in the data-table");
|
||||||
@@ -1953,7 +1953,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
\json_encode($body),
|
\json_encode($body),
|
||||||
$this->featureContext->shareNgGetLastCreatedLinkShareID()
|
$this->featureContext->shareNgGetLastCreatedLinkShareID(),
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -1971,7 +1971,7 @@ class SharingNgContext implements Context {
|
|||||||
public function userTriesToRemoveShareLinkOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(
|
public function userTriesToRemoveShareLinkOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $space,
|
string $space,
|
||||||
string $spaceOwner
|
string $spaceOwner,
|
||||||
): void {
|
): void {
|
||||||
$permissionID = $this->featureContext->shareNgGetLastCreatedLinkShareID();
|
$permissionID = $this->featureContext->shareNgGetLastCreatedLinkShareID();
|
||||||
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
|
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
|
||||||
@@ -1981,7 +1981,7 @@ class SharingNgContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$permissionID
|
$permissionID,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -2003,7 +2003,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId
|
$spaceId,
|
||||||
);
|
);
|
||||||
$responseBody = $this->featureContext->getJsonDecodedResponse($response);
|
$responseBody = $this->featureContext->getJsonDecodedResponse($response);
|
||||||
foreach ($responseBody['value'] as $value) {
|
foreach ($responseBody['value'] as $value) {
|
||||||
@@ -2012,14 +2012,14 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertArrayNotHasKey(
|
Assert::assertArrayNotHasKey(
|
||||||
'link',
|
'link',
|
||||||
$value,
|
$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;
|
break;
|
||||||
case $shareType === "share":
|
case $shareType === "share":
|
||||||
Assert::assertArrayNotHasKey(
|
Assert::assertArrayNotHasKey(
|
||||||
'grantedToV2',
|
'grantedToV2',
|
||||||
$value,
|
$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;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2041,18 +2041,18 @@ class SharingNgContext implements Context {
|
|||||||
public function userShouldBeAbleToSendTheFollowingSpaceShareInvitationWithAllAllowedPermissionRolesUsingRootEndpointOFTheGraphApi(
|
public function userShouldBeAbleToSendTheFollowingSpaceShareInvitationWithAllAllowedPermissionRolesUsingRootEndpointOFTheGraphApi(
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$listPermissionResponse = $this->featureContext->getJsonDecodedResponseBodyContent();
|
$listPermissionResponse = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||||
if (!isset($listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'})) {
|
if (!isset($listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'})) {
|
||||||
Assert::fail(
|
Assert::fail(
|
||||||
"The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n"
|
"The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n"
|
||||||
. $listPermissionResponse
|
. $listPermissionResponse,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Assert::assertNotEmpty(
|
Assert::assertNotEmpty(
|
||||||
$listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'},
|
$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'};
|
$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
|
// 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);
|
$roleAllowed = GraphHelper::getPermissionNameByPermissionRoleId($role->id);
|
||||||
$responseSendInvitation = $this->sendDriveShareInvitation(
|
$responseSendInvitation = $this->sendDriveShareInvitation(
|
||||||
$user,
|
$user,
|
||||||
new TableNode(array_merge($table->getTable(), [['permissionsRole', $roleAllowed]]))
|
new TableNode(array_merge($table->getTable(), [['permissionsRole', $roleAllowed]])),
|
||||||
);
|
);
|
||||||
$jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent(
|
$jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent(
|
||||||
$responseSendInvitation
|
$responseSendInvitation,
|
||||||
);
|
);
|
||||||
$httpsStatusCode = $responseSendInvitation->getStatusCode();
|
$httpsStatusCode = $responseSendInvitation->getStatusCode();
|
||||||
if ($httpsStatusCode === 200 && !empty($jsonResponseSendInvitation->value)) {
|
if ($httpsStatusCode === 200 && !empty($jsonResponseSendInvitation->value)) {
|
||||||
@@ -2101,7 +2101,7 @@ class SharingNgContext implements Context {
|
|||||||
public function userTriesToListThePermissionsOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(
|
public function userTriesToListThePermissionsOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $space,
|
string $space,
|
||||||
string $spaceOwner
|
string $spaceOwner,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
|
$spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"];
|
||||||
|
|
||||||
@@ -2109,7 +2109,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$spaceId
|
$spaceId,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -2124,10 +2124,10 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userRemovesTheLastLinkShareOfSpaceUsingPermissionsEndpointOfGraphApi(
|
public function userRemovesTheLastLinkShareOfSpaceUsingPermissionsEndpointOfGraphApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->removeAccessToSpaceItem($user, 'link', $space, '')
|
$this->removeAccessToSpaceItem($user, 'link', $space, ''),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2152,7 +2152,7 @@ class SharingNgContext implements Context {
|
|||||||
string $space = '',
|
string $space = '',
|
||||||
bool $shouldExist = true,
|
bool $shouldExist = true,
|
||||||
bool $federatedShare = false,
|
bool $federatedShare = false,
|
||||||
string $role = ''
|
string $role = '',
|
||||||
): void {
|
): void {
|
||||||
$share = \ltrim($share, "/");
|
$share = \ltrim($share, "/");
|
||||||
$wasOrNot = $shouldExist ? "was not" : "was";
|
$wasOrNot = $shouldExist ? "was not" : "was";
|
||||||
@@ -2168,7 +2168,7 @@ class SharingNgContext implements Context {
|
|||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$sharee,
|
$sharee,
|
||||||
$this->featureContext->getPasswordForUser($sharee),
|
$this->featureContext->getPasswordForUser($sharee),
|
||||||
""
|
"",
|
||||||
);
|
);
|
||||||
$driveList = HttpRequestHelper::getJsonDecodedResponseBodyContent($response)->value;
|
$driveList = HttpRequestHelper::getJsonDecodedResponseBodyContent($response)->value;
|
||||||
$foundShareMountpoint = false;
|
$foundShareMountpoint = false;
|
||||||
@@ -2183,7 +2183,7 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$shouldExist,
|
$shouldExist,
|
||||||
$foundShareMountpoint,
|
$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(
|
$response = GraphHelper::getSharesSharedWithMe(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$sharee,
|
$sharee,
|
||||||
$this->featureContext->getPasswordForUser($sharee)
|
$this->featureContext->getPasswordForUser($sharee),
|
||||||
);
|
);
|
||||||
$sharedWithMeList = HttpRequestHelper::getJsonDecodedResponseBodyContent($response)->value;
|
$sharedWithMeList = HttpRequestHelper::getJsonDecodedResponseBodyContent($response)->value;
|
||||||
$foundShareInSharedWithMe = false;
|
$foundShareInSharedWithMe = false;
|
||||||
@@ -2207,7 +2207,7 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$role,
|
$role,
|
||||||
$actualRole,
|
$actualRole,
|
||||||
"Expected role '$role' for share '$share' but found '$actualRole'."
|
"Expected role '$role' for share '$share' but found '$actualRole'.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2219,7 +2219,7 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$shouldExist,
|
$shouldExist,
|
||||||
$foundShareInSharedWithMe,
|
$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 $shouldOrNot,
|
||||||
string $share,
|
string $share,
|
||||||
string $sharer,
|
string $sharer,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$this->checkIfShareExists($share, $sharee, $sharer, $space, $shouldOrNot === "should");
|
$this->checkIfShareExists($share, $sharee, $sharer, $space, $shouldOrNot === "should");
|
||||||
}
|
}
|
||||||
@@ -2287,7 +2287,7 @@ class SharingNgContext implements Context {
|
|||||||
string $shouldOrNot,
|
string $shouldOrNot,
|
||||||
string $share,
|
string $share,
|
||||||
string $sharer,
|
string $sharer,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$this->checkIfShareExists($share, $sharee, $sharer, $space, $shouldOrNot === "should", true);
|
$this->checkIfShareExists($share, $sharee, $sharer, $space, $shouldOrNot === "should", true);
|
||||||
}
|
}
|
||||||
@@ -2308,7 +2308,7 @@ class SharingNgContext implements Context {
|
|||||||
string $space,
|
string $space,
|
||||||
string $sharee,
|
string $sharee,
|
||||||
string $role,
|
string $role,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$rows = $table->getRows();
|
$rows = $table->getRows();
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
@@ -2336,7 +2336,7 @@ class SharingNgContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theJsonResponseShouldOrShouldNotContainTheFollowingShares(
|
public function theJsonResponseShouldOrShouldNotContainTheFollowingShares(
|
||||||
string $shouldOrNot,
|
string $shouldOrNot,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
|
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||||
|
|
||||||
@@ -2355,12 +2355,12 @@ class SharingNgContext implements Context {
|
|||||||
if ($shouldOrNot === "should not") {
|
if ($shouldOrNot === "should not") {
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
\in_array($expectedShare, $resourceNames),
|
\in_array($expectedShare, $resourceNames),
|
||||||
"The share '$expectedShare' was found in the response."
|
"The share '$expectedShare' was found in the response.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
\in_array($expectedShare, $resourceNames),
|
\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 $user,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$query = implode('&', $table->getColumn(0));
|
$query = implode('&', $table->getColumn(0));
|
||||||
$this->featureContext->setResponse(
|
$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(
|
public function userGetsAllTheSharesOfTheResource(
|
||||||
string $user,
|
string $user,
|
||||||
string $resource,
|
string $resource,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$permission = $this->getPermissionsList($user, "Shares", $resource);
|
$permission = $this->getPermissionsList($user, "Shares", $resource);
|
||||||
$jsonBody = $this->featureContext->getJsonDecodedResponseBodyContent($permission);
|
$jsonBody = $this->featureContext->getJsonDecodedResponseBodyContent($permission);
|
||||||
@@ -2465,7 +2465,7 @@ class SharingNgContext implements Context {
|
|||||||
Assert::assertSame(
|
Assert::assertSame(
|
||||||
$lastShareId,
|
$lastShareId,
|
||||||
$share['id'],
|
$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 $user,
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||||
$response = $this->tusContext->uploadFileUsingTus($user, $source, $destination, $spaceId);
|
$response = $this->tusContext->uploadFileUsingTus($user, $source, $destination, $spaceId);
|
||||||
@@ -73,7 +73,7 @@ class SpacesTUSContext implements Context {
|
|||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
["201", "204"],
|
["201", "204"],
|
||||||
"HTTP status code was not 201 or 204 while trying to upload file '$destination' for user '$user'",
|
"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 $user,
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||||
try {
|
try {
|
||||||
@@ -107,7 +107,7 @@ class SpacesTUSContext implements Context {
|
|||||||
Assert::fail(
|
Assert::fail(
|
||||||
__METHOD__ .
|
__METHOD__ .
|
||||||
" - Expected an exception, but the upload was successful. Status: " .
|
" - Expected an exception, but the upload was successful. Status: " .
|
||||||
$response->getStatusCode()
|
$response->getStatusCode(),
|
||||||
);
|
);
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
if (!\str_contains($e->getMessage(), "403 Forbidden")) {
|
if (!\str_contains($e->getMessage(), "403 Forbidden")) {
|
||||||
@@ -132,7 +132,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||||
$response = $this->tusContext->uploadFileUsingTus($user, $source, $destination, $spaceId);
|
$response = $this->tusContext->uploadFileUsingTus($user, $source, $destination, $spaceId);
|
||||||
@@ -153,7 +153,7 @@ class SpacesTUSContext implements Context {
|
|||||||
public function thePublicUploadsFileViaTusInsideLastSharedFolderWithPasswordUsingTheWebdavApi(
|
public function thePublicUploadsFileViaTusInsideLastSharedFolderWithPasswordUsingTheWebdavApi(
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->tusContext->publicUploadFileUsingTus($source, $destination, $password);
|
$response = $this->tusContext->publicUploadFileUsingTus($source, $destination, $password);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
@@ -175,7 +175,7 @@ class SpacesTUSContext implements Context {
|
|||||||
public function userHasCreatedANewTusResourceForTheSpaceUsingTheWebdavApiWithTheseHeaders(
|
public function userHasCreatedANewTusResourceForTheSpaceUsingTheWebdavApiWithTheseHeaders(
|
||||||
string $user,
|
string $user,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
TableNode $headers
|
TableNode $headers,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||||
$response = $this->tusContext->createNewTUSResourceWithHeaders($user, $headers, '', $spaceId);
|
$response = $this->tusContext->createNewTUSResourceWithHeaders($user, $headers, '', $spaceId);
|
||||||
@@ -199,7 +199,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $content,
|
string $content,
|
||||||
TableNode $headers
|
TableNode $headers,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||||
$response = $this->tusContext->createNewTUSResourceWithHeaders($user, $headers, $content, $spaceId);
|
$response = $this->tusContext->createNewTUSResourceWithHeaders($user, $headers, $content, $spaceId);
|
||||||
@@ -221,7 +221,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $content,
|
string $content,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||||
$tmpFile = $this->tusContext->writeDataToTempFile($content);
|
$tmpFile = $this->tusContext->writeDataToTempFile($content);
|
||||||
@@ -229,7 +229,7 @@ class SpacesTUSContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
\basename($tmpFile),
|
\basename($tmpFile),
|
||||||
$resource,
|
$resource,
|
||||||
$spaceId
|
$spaceId,
|
||||||
);
|
);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
\unlink($tmpFile);
|
\unlink($tmpFile);
|
||||||
@@ -251,7 +251,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $content,
|
string $content,
|
||||||
string $file,
|
string $file,
|
||||||
string $destination
|
string $destination,
|
||||||
): void {
|
): void {
|
||||||
$remoteItemId = $this->spacesContext->getSharesRemoteItemId($user, $destination);
|
$remoteItemId = $this->spacesContext->getSharesRemoteItemId($user, $destination);
|
||||||
$remoteItemId = \rawurlencode($remoteItemId);
|
$remoteItemId = \rawurlencode($remoteItemId);
|
||||||
@@ -260,7 +260,7 @@ class SpacesTUSContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
\basename($tmpFile),
|
\basename($tmpFile),
|
||||||
$file,
|
$file,
|
||||||
$remoteItemId
|
$remoteItemId,
|
||||||
);
|
);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
\unlink($tmpFile);
|
\unlink($tmpFile);
|
||||||
@@ -282,7 +282,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $content,
|
string $content,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): void {
|
): void {
|
||||||
$isSpacesDavPathVersion = $this->featureContext->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES;
|
$isSpacesDavPathVersion = $this->featureContext->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES;
|
||||||
$resource = \ltrim($resource, "/");
|
$resource = \ltrim($resource, "/");
|
||||||
@@ -309,13 +309,13 @@ class SpacesTUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $content,
|
string $content,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->uploadFileViaTus($user, $content, $resource, $spaceName);
|
$response = $this->uploadFileViaTus($user, $content, $resource, $spaceName);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
["201", "204"],
|
["201", "204"],
|
||||||
"HTTP status code was not 201 or 204 while trying to upload file '$resource' for user '$user'",
|
"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 $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $mtime,
|
string $mtime,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): void {
|
): void {
|
||||||
switch ($mtime) {
|
switch ($mtime) {
|
||||||
case "today":
|
case "today":
|
||||||
@@ -367,7 +367,7 @@ class SpacesTUSContext implements Context {
|
|||||||
$source,
|
$source,
|
||||||
$destination,
|
$destination,
|
||||||
$spaceId,
|
$spaceId,
|
||||||
['mtime' => $mtime]
|
['mtime' => $mtime],
|
||||||
);
|
);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -392,7 +392,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $checksum,
|
string $checksum,
|
||||||
string $offset,
|
string $offset,
|
||||||
string $content,
|
string $content,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): void {
|
): void {
|
||||||
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
||||||
$response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
$response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
||||||
@@ -418,7 +418,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $checksum,
|
string $checksum,
|
||||||
string $offset,
|
string $offset,
|
||||||
string $content,
|
string $content,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): void {
|
): void {
|
||||||
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
||||||
$response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
$response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
||||||
@@ -444,7 +444,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $offset,
|
string $offset,
|
||||||
string $data,
|
string $data,
|
||||||
string $checksum,
|
string $checksum,
|
||||||
string $spaceName
|
string $spaceName,
|
||||||
): void {
|
): void {
|
||||||
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
||||||
$response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum);
|
$response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum);
|
||||||
@@ -464,7 +464,7 @@ class SpacesTUSContext implements Context {
|
|||||||
public function userSendsAChunkToTheLastCreatedTusLocationWithDataInsideOfTheSpaceWithHeaders(
|
public function userSendsAChunkToTheLastCreatedTusLocationWithDataInsideOfTheSpaceWithHeaders(
|
||||||
string $user,
|
string $user,
|
||||||
string $data,
|
string $data,
|
||||||
TableNode $headers
|
TableNode $headers,
|
||||||
): void {
|
): void {
|
||||||
$rows = $headers->getRowsHash();
|
$rows = $headers->getRowsHash();
|
||||||
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
$resourceLocation = $this->tusContext->getLastTusResourceLocation();
|
||||||
@@ -474,7 +474,7 @@ class SpacesTUSContext implements Context {
|
|||||||
$rows['Upload-Offset'],
|
$rows['Upload-Offset'],
|
||||||
$data,
|
$data,
|
||||||
$rows['Upload-Checksum'],
|
$rows['Upload-Checksum'],
|
||||||
['Origin' => $rows['Origin']]
|
['Origin' => $rows['Origin']],
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $data,
|
string $data,
|
||||||
string $checksum,
|
string $checksum,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
TableNode $headers
|
TableNode $headers,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||||
$createResponse = $this->tusContext->createNewTUSResource($user, $headers, $spaceId);
|
$createResponse = $this->tusContext->createNewTUSResource($user, $headers, $spaceId);
|
||||||
@@ -525,7 +525,7 @@ class SpacesTUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $mtime
|
string $mtime,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName);
|
||||||
$mtime = new DateTime($mtime);
|
$mtime = new DateTime($mtime);
|
||||||
@@ -538,7 +538,7 @@ class SpacesTUSContext implements Context {
|
|||||||
$resource,
|
$resource,
|
||||||
$this->featureContext->getDavPathVersion(),
|
$this->featureContext->getDavPathVersion(),
|
||||||
$spaceId,
|
$spaceId,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class TUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
TableNode $headersTable,
|
TableNode $headersTable,
|
||||||
string $content = '',
|
string $content = '',
|
||||||
?string $spaceId = null
|
?string $spaceId = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$this->featureContext->verifyTableNodeColumnsCount($headersTable, 2);
|
$this->featureContext->verifyTableNodeColumnsCount($headersTable, 2);
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
@@ -117,7 +117,7 @@ class TUSContext implements Context {
|
|||||||
"files",
|
"files",
|
||||||
null,
|
null,
|
||||||
false,
|
false,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
$locationHeader = $response->getHeader('Location');
|
$locationHeader = $response->getHeader('Location');
|
||||||
if (\sizeof($locationHeader) > 0) {
|
if (\sizeof($locationHeader) > 0) {
|
||||||
@@ -192,7 +192,7 @@ class TUSContext implements Context {
|
|||||||
string $offset,
|
string $offset,
|
||||||
string $data,
|
string $data,
|
||||||
string $checksum = '',
|
string $checksum = '',
|
||||||
?array $extraHeaders = null
|
?array $extraHeaders = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$password = $this->featureContext->getUserPassword($user);
|
$password = $this->featureContext->getUserPassword($user);
|
||||||
@@ -210,7 +210,7 @@ class TUSContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$password,
|
$password,
|
||||||
$headers,
|
$headers,
|
||||||
$data
|
$data,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@ class TUSContext implements Context {
|
|||||||
array $uploadMetadata = [],
|
array $uploadMetadata = [],
|
||||||
int $noOfChunks = 1,
|
int $noOfChunks = 1,
|
||||||
int $bytes = null,
|
int $bytes = null,
|
||||||
string $checksum = ''
|
string $checksum = '',
|
||||||
): void {
|
): void {
|
||||||
$response = $this->uploadFileUsingTus(
|
$response = $this->uploadFileUsingTus(
|
||||||
$user,
|
$user,
|
||||||
@@ -270,7 +270,7 @@ class TUSContext implements Context {
|
|||||||
$uploadMetadata,
|
$uploadMetadata,
|
||||||
$noOfChunks,
|
$noOfChunks,
|
||||||
$bytes,
|
$bytes,
|
||||||
$checksum
|
$checksum,
|
||||||
);
|
);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -330,7 +330,7 @@ class TUSContext implements Context {
|
|||||||
$sourceFile,
|
$sourceFile,
|
||||||
$destination,
|
$destination,
|
||||||
WebDavHelper::getDavPath($davPathVersion, $suffixPath),
|
WebDavHelper::getDavPath($davPathVersion, $suffixPath),
|
||||||
$uploadMetadata
|
$uploadMetadata,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->featureContext->pauseUploadDelete();
|
$this->featureContext->pauseUploadDelete();
|
||||||
@@ -381,7 +381,7 @@ class TUSContext implements Context {
|
|||||||
$headers,
|
$headers,
|
||||||
$sourceFile,
|
$sourceFile,
|
||||||
$destination,
|
$destination,
|
||||||
$url
|
$url,
|
||||||
);
|
);
|
||||||
$response = $client->createWithUploadRR("", 0);
|
$response = $client->createWithUploadRR("", 0);
|
||||||
return $response;
|
return $response;
|
||||||
@@ -406,14 +406,14 @@ class TUSContext implements Context {
|
|||||||
string $sourceFile,
|
string $sourceFile,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $path,
|
string $path,
|
||||||
array $metadata = []
|
array $metadata = [],
|
||||||
): TusClient {
|
): TusClient {
|
||||||
$client = new TusClient(
|
$client = new TusClient(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
[
|
[
|
||||||
'verify' => false,
|
'verify' => false,
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
$client->setApiPath($path);
|
$client->setApiPath($path);
|
||||||
$client->setMetadata($metadata);
|
$client->setMetadata($metadata);
|
||||||
@@ -436,13 +436,13 @@ class TUSContext implements Context {
|
|||||||
public function userUploadsAFileWithContentToUsingTus(
|
public function userUploadsAFileWithContentToUsingTus(
|
||||||
string $user,
|
string $user,
|
||||||
string $content,
|
string $content,
|
||||||
string $destination
|
string $destination,
|
||||||
): void {
|
): void {
|
||||||
$temporaryFileName = $this->writeDataToTempFile($content);
|
$temporaryFileName = $this->writeDataToTempFile($content);
|
||||||
$response = $this->uploadFileUsingTus(
|
$response = $this->uploadFileUsingTus(
|
||||||
$user,
|
$user,
|
||||||
\basename($temporaryFileName),
|
\basename($temporaryFileName),
|
||||||
$destination
|
$destination,
|
||||||
);
|
);
|
||||||
\unlink($temporaryFileName);
|
\unlink($temporaryFileName);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -469,7 +469,7 @@ class TUSContext implements Context {
|
|||||||
?string $user,
|
?string $user,
|
||||||
string $content,
|
string $content,
|
||||||
?int $noOfChunks,
|
?int $noOfChunks,
|
||||||
string $destination
|
string $destination,
|
||||||
): void {
|
): void {
|
||||||
$temporaryFileName = $this->writeDataToTempFile($content);
|
$temporaryFileName = $this->writeDataToTempFile($content);
|
||||||
$response = $this->uploadFileUsingTus(
|
$response = $this->uploadFileUsingTus(
|
||||||
@@ -478,7 +478,7 @@ class TUSContext implements Context {
|
|||||||
$destination,
|
$destination,
|
||||||
null,
|
null,
|
||||||
[],
|
[],
|
||||||
$noOfChunks
|
$noOfChunks,
|
||||||
);
|
);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
\unlink($temporaryFileName);
|
\unlink($temporaryFileName);
|
||||||
@@ -501,7 +501,7 @@ class TUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $mtime
|
string $mtime,
|
||||||
): void {
|
): void {
|
||||||
$mtime = new DateTime($mtime);
|
$mtime = new DateTime($mtime);
|
||||||
$mtime = $mtime->format('U');
|
$mtime = $mtime->format('U');
|
||||||
@@ -511,13 +511,13 @@ class TUSContext implements Context {
|
|||||||
$source,
|
$source,
|
||||||
$destination,
|
$destination,
|
||||||
null,
|
null,
|
||||||
['mtime' => $mtime]
|
['mtime' => $mtime],
|
||||||
);
|
);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
["201", "204"],
|
["201", "204"],
|
||||||
"Failed to upload file '$source' for user '$user'",
|
"Failed to upload file '$source' for user '$user'",
|
||||||
$response
|
$response,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,7 +537,7 @@ class TUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $source,
|
string $source,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $mtime
|
string $mtime,
|
||||||
): void {
|
): void {
|
||||||
$mtime = new DateTime($mtime);
|
$mtime = new DateTime($mtime);
|
||||||
$mtime = $mtime->format('U');
|
$mtime = $mtime->format('U');
|
||||||
@@ -547,7 +547,7 @@ class TUSContext implements Context {
|
|||||||
$source,
|
$source,
|
||||||
$destination,
|
$destination,
|
||||||
null,
|
null,
|
||||||
['mtime' => $mtime]
|
['mtime' => $mtime],
|
||||||
);
|
);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -562,7 +562,7 @@ class TUSContext implements Context {
|
|||||||
public function writeDataToTempFile(string $content): string {
|
public function writeDataToTempFile(string $content): string {
|
||||||
$temporaryFileName = \tempnam(
|
$temporaryFileName = \tempnam(
|
||||||
$this->featureContext->acceptanceTestsDirLocation(),
|
$this->featureContext->acceptanceTestsDirLocation(),
|
||||||
"tus-upload-test-"
|
"tus-upload-test-",
|
||||||
);
|
);
|
||||||
if ($temporaryFileName === false) {
|
if ($temporaryFileName === false) {
|
||||||
throw new \Exception("could not create a temporary filename");
|
throw new \Exception("could not create a temporary filename");
|
||||||
@@ -606,7 +606,7 @@ class TUSContext implements Context {
|
|||||||
public function userCreatesWithUpload(
|
public function userCreatesWithUpload(
|
||||||
string $user,
|
string $user,
|
||||||
string $content,
|
string $content,
|
||||||
TableNode $headers
|
TableNode $headers,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->createNewTUSResourceWithHeaders($user, $headers, $content);
|
$response = $this->createNewTUSResourceWithHeaders($user, $headers, $content);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -625,7 +625,7 @@ class TUSContext implements Context {
|
|||||||
public function userUploadsWithCreatesWithUpload(
|
public function userUploadsWithCreatesWithUpload(
|
||||||
string $user,
|
string $user,
|
||||||
string $source,
|
string $source,
|
||||||
string $content
|
string $content,
|
||||||
): void {
|
): void {
|
||||||
$temporaryFileName = $this->writeDataToTempFile($content);
|
$temporaryFileName = $this->writeDataToTempFile($content);
|
||||||
$response = $this->uploadFileUsingTus(
|
$response = $this->uploadFileUsingTus(
|
||||||
@@ -635,7 +635,7 @@ class TUSContext implements Context {
|
|||||||
null,
|
null,
|
||||||
[],
|
[],
|
||||||
1,
|
1,
|
||||||
-1
|
-1,
|
||||||
);
|
);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
\unlink($temporaryFileName);
|
\unlink($temporaryFileName);
|
||||||
@@ -657,7 +657,7 @@ class TUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $checksum,
|
string $checksum,
|
||||||
string $offset,
|
string $offset,
|
||||||
string $content
|
string $content,
|
||||||
): void {
|
): void {
|
||||||
$resourceLocation = $this->getLastTusResourceLocation();
|
$resourceLocation = $this->getLastTusResourceLocation();
|
||||||
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
||||||
@@ -684,7 +684,7 @@ class TUSContext implements Context {
|
|||||||
string $checksum,
|
string $checksum,
|
||||||
string $offset,
|
string $offset,
|
||||||
string $locationIndex,
|
string $locationIndex,
|
||||||
string $filename
|
string $filename,
|
||||||
): void {
|
): void {
|
||||||
$filenameHash = \base64_encode($filename);
|
$filenameHash = \base64_encode($filename);
|
||||||
$resourceLocation = $this->getTusResourceLocation($filenameHash, (int)$locationIndex);
|
$resourceLocation = $this->getTusResourceLocation($filenameHash, (int)$locationIndex);
|
||||||
@@ -707,7 +707,7 @@ class TUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $checksum,
|
string $checksum,
|
||||||
string $offset,
|
string $offset,
|
||||||
string $content
|
string $content,
|
||||||
): void {
|
): void {
|
||||||
$resourceLocation = $this->getLastTusResourceLocation();
|
$resourceLocation = $this->getLastTusResourceLocation();
|
||||||
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $content, $checksum);
|
||||||
@@ -729,7 +729,7 @@ class TUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $offset,
|
string $offset,
|
||||||
string $data,
|
string $data,
|
||||||
string $checksum
|
string $checksum,
|
||||||
): void {
|
): void {
|
||||||
$resourceLocation = $this->getLastTusResourceLocation();
|
$resourceLocation = $this->getLastTusResourceLocation();
|
||||||
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum);
|
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum);
|
||||||
@@ -751,7 +751,7 @@ class TUSContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $offset,
|
string $offset,
|
||||||
string $data,
|
string $data,
|
||||||
string $checksum
|
string $checksum,
|
||||||
): void {
|
): void {
|
||||||
$resourceLocation = $this->getLastTusResourceLocation();
|
$resourceLocation = $this->getLastTusResourceLocation();
|
||||||
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum);
|
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum);
|
||||||
@@ -778,7 +778,7 @@ class TUSContext implements Context {
|
|||||||
string $offset,
|
string $offset,
|
||||||
string $data,
|
string $data,
|
||||||
string $checksum,
|
string $checksum,
|
||||||
TableNode $headers
|
TableNode $headers,
|
||||||
): void {
|
): void {
|
||||||
$createResponse = $this->createNewTUSResource($user, $headers);
|
$createResponse = $this->createNewTUSResource($user, $headers);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $createResponse);
|
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $createResponse);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class TagContext implements Context {
|
|||||||
string $fileOrFolder,
|
string $fileOrFolder,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space,
|
string $space,
|
||||||
array $tagNameArray
|
array $tagNameArray,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
if ($fileOrFolder === 'folder' || $fileOrFolder === 'folders') {
|
if ($fileOrFolder === 'folder' || $fileOrFolder === 'folders') {
|
||||||
$resourceId = $this->spacesContext->getResourceId($user, $space, $resource);
|
$resourceId = $this->spacesContext->getResourceId($user, $space, $resource);
|
||||||
@@ -82,7 +82,7 @@ class TagContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$resourceId,
|
$resourceId,
|
||||||
$tagNameArray
|
$tagNameArray,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ class TagContext implements Context {
|
|||||||
string $fileOrFolder,
|
string $fileOrFolder,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$tagNameArray = [];
|
$tagNameArray = [];
|
||||||
foreach ($table->getRows() as $value) {
|
foreach ($table->getRows() as $value) {
|
||||||
@@ -130,7 +130,7 @@ class TagContext implements Context {
|
|||||||
string $fileOrFolder,
|
string $fileOrFolder,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$tagNameArray = [];
|
$tagNameArray = [];
|
||||||
foreach ($table->getRows() as $value) {
|
foreach ($table->getRows() as $value) {
|
||||||
@@ -155,7 +155,7 @@ class TagContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $filesOrFolders,
|
string $filesOrFolders,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->verifyTableNodeColumns($table, ["path", "tagName"]);
|
$this->featureContext->verifyTableNodeColumns($table, ["path", "tagName"]);
|
||||||
$rows = $table->getHash();
|
$rows = $table->getHash();
|
||||||
@@ -183,7 +183,7 @@ class TagContext implements Context {
|
|||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,19 +200,19 @@ class TagContext implements Context {
|
|||||||
$rows = $table->getRows();
|
$rows = $table->getRows();
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$responseArray = $this->featureContext->getJsonDecodedResponse(
|
$responseArray = $this->featureContext->getJsonDecodedResponse(
|
||||||
$this->featureContext->getResponse()
|
$this->featureContext->getResponse(),
|
||||||
)['value'];
|
)['value'];
|
||||||
if ($shouldOrNot === "not") {
|
if ($shouldOrNot === "not") {
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
\in_array($row[0], $responseArray),
|
\in_array($row[0], $responseArray),
|
||||||
"the response should not contain the tag $row[0].\nResponse\n"
|
"the response should not contain the tag $row[0].\nResponse\n"
|
||||||
. print_r($responseArray, true)
|
. print_r($responseArray, true),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
\in_array($row[0], $responseArray),
|
\in_array($row[0], $responseArray),
|
||||||
"the response does not contain the tag $row[0].\nResponse\n"
|
"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 $fileOrFolder,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$tagNameArray = [];
|
$tagNameArray = [];
|
||||||
foreach ($table->getRows() as $value) {
|
foreach ($table->getRows() as $value) {
|
||||||
@@ -251,7 +251,7 @@ class TagContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$resourceId,
|
$resourceId,
|
||||||
$tagNameArray
|
$tagNameArray,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,14 +272,14 @@ class TagContext implements Context {
|
|||||||
string $fileOrFolder,
|
string $fileOrFolder,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->removeTagsFromResourceOfTheSpace(
|
$response = $this->removeTagsFromResourceOfTheSpace(
|
||||||
$user,
|
$user,
|
||||||
$fileOrFolder,
|
$fileOrFolder,
|
||||||
$resource,
|
$resource,
|
||||||
$space,
|
$space,
|
||||||
$table
|
$table,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ class TagContext implements Context {
|
|||||||
string $fileOrFolder,
|
string $fileOrFolder,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->removeTagsFromResourceOfTheSpace($user, $fileOrFolder, $resource, $space, $table);
|
$response = $this->removeTagsFromResourceOfTheSpace($user, $fileOrFolder, $resource, $space, $table);
|
||||||
$this->featureContext->theHttpStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHttpStatusCodeShouldBe(200, "", $response);
|
||||||
@@ -324,7 +324,7 @@ class TagContext implements Context {
|
|||||||
int $numberOfTags,
|
int $numberOfTags,
|
||||||
string $fileOrFolder,
|
string $fileOrFolder,
|
||||||
string $resource,
|
string $resource,
|
||||||
string $space
|
string $space,
|
||||||
): void {
|
): void {
|
||||||
$tagNames = [];
|
$tagNames = [];
|
||||||
foreach (range(1, $numberOfTags) as $tagNumber) {
|
foreach (range(1, $numberOfTags) as $tagNumber) {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class TrashbinContext implements Context {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
$davPathVersion,
|
$davPathVersion,
|
||||||
'trash-bin'
|
'trash-bin',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ class TrashbinContext implements Context {
|
|||||||
static function (SimpleXMLElement $propStat) {
|
static function (SimpleXMLElement $propStat) {
|
||||||
$status = $propStat->xpath('./d:status');
|
$status = $propStat->xpath('./d:status');
|
||||||
return (string) $status[0] === 'HTTP/1.1 200 OK';
|
return (string) $status[0] === 'HTTP/1.1 200 OK';
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
if (isset($successPropStat[0])) {
|
if (isset($successPropStat[0])) {
|
||||||
$successPropStat = $successPropStat[0];
|
$successPropStat = $successPropStat[0];
|
||||||
@@ -131,7 +131,7 @@ class TrashbinContext implements Context {
|
|||||||
'original-location' => isset($originalLocation[0]) ? (string) $originalLocation[0] : null,
|
'original-location' => isset($originalLocation[0]) ? (string) $originalLocation[0] : null,
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
$xmlElements
|
$xmlElements,
|
||||||
);
|
);
|
||||||
|
|
||||||
return $files;
|
return $files;
|
||||||
@@ -174,15 +174,15 @@ class TrashbinContext implements Context {
|
|||||||
'd:getlastmodified',
|
'd:getlastmodified',
|
||||||
],
|
],
|
||||||
'trash-bin',
|
'trash-bin',
|
||||||
$davPathVersion
|
$davPathVersion,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
|
|
||||||
$files = $this->getTrashbinContentFromResponseXml(
|
$files = $this->getTrashbinContentFromResponseXml(
|
||||||
HttpRequestHelper::getResponseXml(
|
HttpRequestHelper::getResponseXml(
|
||||||
$response,
|
$response,
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
// filter root element
|
// filter root element
|
||||||
$files = \array_filter(
|
$files = \array_filter(
|
||||||
@@ -190,7 +190,7 @@ class TrashbinContext implements Context {
|
|||||||
static function ($element) use ($davPathVersion, $suffixPath) {
|
static function ($element) use ($davPathVersion, $suffixPath) {
|
||||||
$davPath = WebDavHelper::getDavPath($davPathVersion, $suffixPath, "trash-bin");
|
$davPath = WebDavHelper::getDavPath($davPathVersion, $suffixPath, "trash-bin");
|
||||||
return ($element['href'] !== "/" . $davPath . "/");
|
return ($element['href'] !== "/" . $davPath . "/");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ class TrashbinContext implements Context {
|
|||||||
return $this->listTrashbinFolderCollection(
|
return $this->listTrashbinFolderCollection(
|
||||||
$user,
|
$user,
|
||||||
"",
|
"",
|
||||||
$depth
|
$depth,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ class TrashbinContext implements Context {
|
|||||||
?string $user,
|
?string $user,
|
||||||
?string $collectionPath = "",
|
?string $collectionPath = "",
|
||||||
string $depth = "1",
|
string $depth = "1",
|
||||||
int $level = 1
|
int $level = 1,
|
||||||
): array {
|
): array {
|
||||||
// $collectionPath should be some list of file-ids like 2147497661/2147497662
|
// $collectionPath should be some list of file-ids like 2147497661/2147497662
|
||||||
// or the empty string, which will list the whole trashbin from the top.
|
// or the empty string, which will list the whole trashbin from the top.
|
||||||
@@ -249,7 +249,7 @@ class TrashbinContext implements Context {
|
|||||||
'd:getlastmodified',
|
'd:getlastmodified',
|
||||||
],
|
],
|
||||||
'trash-bin',
|
'trash-bin',
|
||||||
$davPathVersion
|
$davPathVersion,
|
||||||
);
|
);
|
||||||
$response->getBody()->rewind();
|
$response->getBody()->rewind();
|
||||||
$statusCode = $response->getStatusCode();
|
$statusCode = $response->getStatusCode();
|
||||||
@@ -257,14 +257,14 @@ class TrashbinContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
"207",
|
"207",
|
||||||
$statusCode,
|
$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(
|
$files = $this->getTrashbinContentFromResponseXml(
|
||||||
HttpRequestHelper::getResponseXml(
|
HttpRequestHelper::getResponseXml(
|
||||||
$response,
|
$response,
|
||||||
__METHOD__ . " $collectionPath"
|
__METHOD__ . " $collectionPath",
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$suffixPath = $user;
|
$suffixPath = $user;
|
||||||
@@ -286,7 +286,7 @@ class TrashbinContext implements Context {
|
|||||||
$path = $path . "/";
|
$path = $path . "/";
|
||||||
}
|
}
|
||||||
return ($element['href'] !== "/$endpoint/$path");
|
return ($element['href'] !== "/$endpoint/$path");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
@@ -302,7 +302,7 @@ class TrashbinContext implements Context {
|
|||||||
// in the response. That should never happen, or have been filtered out
|
// in the response. That should never happen, or have been filtered out
|
||||||
// by the code above.
|
// by the code above.
|
||||||
throw new Exception(
|
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"]) {
|
if ($file["collection"]) {
|
||||||
@@ -313,14 +313,14 @@ class TrashbinContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$trashbinId,
|
$trashbinId,
|
||||||
$depth,
|
$depth,
|
||||||
$level + 1
|
$level + 1,
|
||||||
);
|
);
|
||||||
// Filter the collection element. We only want the members.
|
// Filter the collection element. We only want the members.
|
||||||
$nextFiles = \array_filter(
|
$nextFiles = \array_filter(
|
||||||
$nextFiles,
|
$nextFiles,
|
||||||
static function ($element) use ($user, $trashbinRef) {
|
static function ($element) use ($user, $trashbinRef) {
|
||||||
return ($element['href'] !== $trashbinRef);
|
return ($element['href'] !== $trashbinRef);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
\array_push($files, ...$nextFiles);
|
\array_push($files, ...$nextFiles);
|
||||||
}
|
}
|
||||||
@@ -352,7 +352,7 @@ class TrashbinContext implements Context {
|
|||||||
public function theTrashbinDavResponseShouldNotContainTheseNodes(TableNode $table): void {
|
public function theTrashbinDavResponseShouldNotContainTheseNodes(TableNode $table): void {
|
||||||
$this->featureContext->verifyTableNodeColumns($table, ['name']);
|
$this->featureContext->verifyTableNodeColumns($table, ['name']);
|
||||||
$files = $this->getTrashbinContentFromResponseXml(
|
$files = $this->getTrashbinContentFromResponseXml(
|
||||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__)
|
HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
@@ -377,7 +377,7 @@ class TrashbinContext implements Context {
|
|||||||
$this->featureContext->verifyTableNodeColumns($table, ['name']);
|
$this->featureContext->verifyTableNodeColumns($table, ['name']);
|
||||||
|
|
||||||
$files = $this->getTrashbinContentFromResponseXml(
|
$files = $this->getTrashbinContentFromResponseXml(
|
||||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__)
|
HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($table->getHash() as $row) {
|
foreach ($table->getHash() as $row) {
|
||||||
@@ -408,7 +408,7 @@ class TrashbinContext implements Context {
|
|||||||
public function sendTrashbinListRequest(
|
public function sendTrashbinListRequest(
|
||||||
string $user,
|
string $user,
|
||||||
?string $asUser = null,
|
?string $asUser = null,
|
||||||
?string $password = null
|
?string $password = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$asUser = $asUser ?? $user;
|
$asUser = $asUser ?? $user;
|
||||||
$password = $password ?? $this->featureContext->getPasswordForUser($asUser);
|
$password = $password ?? $this->featureContext->getPasswordForUser($asUser);
|
||||||
@@ -428,7 +428,7 @@ class TrashbinContext implements Context {
|
|||||||
null,
|
null,
|
||||||
'trash-bin',
|
'trash-bin',
|
||||||
$this->featureContext->getDavPathVersion(),
|
$this->featureContext->getDavPathVersion(),
|
||||||
$asUser
|
$asUser,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ class TrashbinContext implements Context {
|
|||||||
public function userTriesToListTheTrashbinContentForUserUsingPassword(
|
public function userTriesToListTheTrashbinContentForUserUsingPassword(
|
||||||
string $asUser,
|
string $asUser,
|
||||||
string $user,
|
string $user,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->sendTrashbinListRequest($user, $asUser, $password);
|
$response = $this->sendTrashbinListRequest($user, $asUser, $password);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -500,7 +500,7 @@ class TrashbinContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theLastWebdavResponseShouldNotContainFollowingElements(TableNode $elements): void {
|
public function theLastWebdavResponseShouldNotContainFollowingElements(TableNode $elements): void {
|
||||||
$files = $this->getTrashbinContentFromResponseXml(
|
$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
|
// '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 $user,
|
||||||
string $path,
|
string $path,
|
||||||
string $ofUser,
|
string $ofUser,
|
||||||
string $password
|
string $password,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->deleteItemFromTrashbin($user, $path, $ofUser, $password);
|
$response = $this->deleteItemFromTrashbin($user, $path, $ofUser, $password);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -593,7 +593,7 @@ class TrashbinContext implements Context {
|
|||||||
?string $asUser,
|
?string $asUser,
|
||||||
?string $path,
|
?string $path,
|
||||||
?string $user,
|
?string $user,
|
||||||
?string $password
|
?string $password,
|
||||||
): void {
|
): void {
|
||||||
$asUser = $this->featureContext->getActualUsername($asUser);
|
$asUser = $this->featureContext->getActualUsername($asUser);
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
@@ -627,7 +627,7 @@ class TrashbinContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function userTriesToDeleteFileWithOriginalPathFromTrashbinUsingTrashbinAPI(
|
public function userTriesToDeleteFileWithOriginalPathFromTrashbinUsingTrashbinAPI(
|
||||||
string $user,
|
string $user,
|
||||||
string $originalPath
|
string $originalPath,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->deleteItemFromTrashbin($user, $originalPath);
|
$response = $this->deleteItemFromTrashbin($user, $originalPath);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -645,7 +645,7 @@ class TrashbinContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $originalPath,
|
string $originalPath,
|
||||||
?string $ofUser = null,
|
?string $ofUser = null,
|
||||||
?string $password = null
|
?string $password = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$ofUser = $ofUser ?? $user;
|
$ofUser = $ofUser ?? $user;
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
@@ -668,7 +668,7 @@ class TrashbinContext implements Context {
|
|||||||
if ($path === "") {
|
if ($path === "") {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
__METHOD__
|
__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,
|
$fullUrl,
|
||||||
"DELETE",
|
"DELETE",
|
||||||
$user,
|
$user,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -751,7 +751,7 @@ class TrashbinContext implements Context {
|
|||||||
|
|
||||||
Assert::assertNotNull(
|
Assert::assertNotNull(
|
||||||
$firstEntry,
|
$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) {
|
if (\count($sections) !== 1) {
|
||||||
@@ -779,7 +779,7 @@ class TrashbinContext implements Context {
|
|||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$found,
|
$found,
|
||||||
__METHOD__
|
__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 $trashItemHRef,
|
||||||
string $destinationPath,
|
string $destinationPath,
|
||||||
?string $asUser = null,
|
?string $asUser = null,
|
||||||
?string $password = null
|
?string $password = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$asUser = $asUser ?? $user;
|
$asUser = $asUser ?? $user;
|
||||||
$password = $password ?? $this->featureContext->getPasswordForUser($asUser);
|
$password = $password ?? $this->featureContext->getPasswordForUser($asUser);
|
||||||
@@ -860,7 +860,7 @@ class TrashbinContext implements Context {
|
|||||||
false,
|
false,
|
||||||
$password,
|
$password,
|
||||||
[],
|
[],
|
||||||
$asUser
|
$asUser,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -880,7 +880,7 @@ class TrashbinContext implements Context {
|
|||||||
string $originalPath,
|
string $originalPath,
|
||||||
?string $destinationPath = null,
|
?string $destinationPath = null,
|
||||||
?string $asUser = null,
|
?string $asUser = null,
|
||||||
?string $password = null
|
?string $password = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$asUser = $asUser ?? $user;
|
$asUser = $asUser ?? $user;
|
||||||
$listing = $this->listTrashbinFolder($user);
|
$listing = $this->listTrashbinFolder($user);
|
||||||
@@ -895,7 +895,7 @@ class TrashbinContext implements Context {
|
|||||||
$entry['href'],
|
$entry['href'],
|
||||||
$destinationPath,
|
$destinationPath,
|
||||||
$asUser,
|
$asUser,
|
||||||
$password
|
$password,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -904,7 +904,8 @@ class TrashbinContext implements Context {
|
|||||||
// is also no up-to-date response to examine in later test steps.
|
// is also no up-to-date response to examine in later test steps.
|
||||||
throw new \Exception(
|
throw new \Exception(
|
||||||
__METHOD__
|
__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(
|
public function userRestoresResourceWithOriginalPathWithoutSpecifyingDestinationUsingTrashbinApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $originalPath
|
string $originalPath,
|
||||||
): void {
|
): void {
|
||||||
$listing = $this->listTrashbinFolder($user);
|
$listing = $this->listTrashbinFolder($user);
|
||||||
$originalPath = \trim($originalPath, '/');
|
$originalPath = \trim($originalPath, '/');
|
||||||
@@ -935,8 +936,8 @@ class TrashbinContext implements Context {
|
|||||||
[],
|
[],
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
'trash-bin'
|
'trash-bin',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -961,7 +962,7 @@ class TrashbinContext implements Context {
|
|||||||
?string $fileName,
|
?string $fileName,
|
||||||
?string $user,
|
?string $user,
|
||||||
?string $content,
|
?string $content,
|
||||||
?string $alternativeContent
|
?string $alternativeContent,
|
||||||
): void {
|
): void {
|
||||||
$isInTrash = $this->isInTrash($user, $fileName);
|
$isInTrash = $this->isInTrash($user, $fileName);
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
@@ -1039,7 +1040,7 @@ class TrashbinContext implements Context {
|
|||||||
public function userRestoresTheFileWithOriginalPathToUsingTheTrashbinApi(
|
public function userRestoresTheFileWithOriginalPathToUsingTheTrashbinApi(
|
||||||
?string $user,
|
?string $user,
|
||||||
?string $originalPath,
|
?string $originalPath,
|
||||||
?string $destinationPath
|
?string $destinationPath,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$this->featureContext->setResponse($this->restoreElement($user, $originalPath, $destinationPath));
|
$this->featureContext->setResponse($this->restoreElement($user, $originalPath, $destinationPath));
|
||||||
@@ -1057,12 +1058,12 @@ class TrashbinContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function elementIsInTrashCheckingOriginalPath(
|
public function elementIsInTrashCheckingOriginalPath(
|
||||||
?string $user,
|
?string $user,
|
||||||
?string $originalPath
|
?string $originalPath,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$this->isInTrash($user, $originalPath),
|
$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(
|
public function elementIsNotInTrashCheckingOriginalPath(
|
||||||
?string $user,
|
?string $user,
|
||||||
string $originalPath
|
string $originalPath,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
$this->isInTrash($user, $originalPath),
|
$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(
|
public function followingElementsAreNotInTrashCheckingOriginalPath(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->verifyTableNodeColumns($table, ["path"]);
|
$this->featureContext->verifyTableNodeColumns($table, ["path"]);
|
||||||
$paths = $table->getHash();
|
$paths = $table->getHash();
|
||||||
@@ -1106,7 +1107,7 @@ class TrashbinContext implements Context {
|
|||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
$this->isInTrash($user, $originalPath["path"]),
|
$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(
|
public function followingElementsAreInTrashCheckingOriginalPath(
|
||||||
string $user,
|
string $user,
|
||||||
TableNode $table
|
TableNode $table,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->verifyTableNodeColumns($table, ["path"]);
|
$this->featureContext->verifyTableNodeColumns($table, ["path"]);
|
||||||
$paths = $table->getHash();
|
$paths = $table->getHash();
|
||||||
@@ -1131,7 +1132,7 @@ class TrashbinContext implements Context {
|
|||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$this->isInTrash($user, $originalPath["path"]),
|
$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 {
|
public function theDeletedFileFolderShouldHaveCorrectDeletionMtimeInTheResponse(string $resource): void {
|
||||||
$files = $this->getTrashbinContentFromResponseXml(
|
$files = $this->getTrashbinContentFromResponseXml(
|
||||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse())
|
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
||||||
);
|
);
|
||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
@@ -1203,7 +1204,7 @@ class TrashbinContext implements Context {
|
|||||||
}
|
}
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$found,
|
$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,
|
string $fullUrl = null,
|
||||||
bool $public = false,
|
bool $public = false,
|
||||||
bool $expectToSucceed = true,
|
bool $expectToSucceed = true,
|
||||||
?string $spaceId = null
|
?string $spaceId = null,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
if ($public === true) {
|
if ($public === true) {
|
||||||
@@ -102,7 +102,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$headers,
|
$headers,
|
||||||
$body
|
$body,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$baseUrl = $this->featureContext->getBaseUrl();
|
$baseUrl = $this->featureContext->getBaseUrl();
|
||||||
@@ -116,7 +116,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$spaceId,
|
$spaceId,
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->getDavPathVersion(),
|
$this->featureContext->getDavPathVersion(),
|
||||||
$type
|
$type,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ class WebDavLockingContext implements Context {
|
|||||||
public function userLocksFileSettingPropertiesUsingWebDavAPI(
|
public function userLocksFileSettingPropertiesUsingWebDavAPI(
|
||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = null;
|
$spaceId = null;
|
||||||
if (\str_starts_with($file, "Shares/")
|
if (\str_starts_with($file, "Shares/")
|
||||||
@@ -169,7 +169,7 @@ class WebDavLockingContext implements Context {
|
|||||||
public function userTriesToLockFileSettingPropertiesUsingWebDavAPI(
|
public function userTriesToLockFileSettingPropertiesUsingWebDavAPI(
|
||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->lockFile($user, $file, $properties, null, false, false);
|
$response = $this->lockFile($user, $file, $properties, null, false, false);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -190,7 +190,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$this->featureContext->setResponse($this->userLocksFileInProjectSpace($user, $file, $space, $properties));
|
$this->featureContext->setResponse($this->userLocksFileInProjectSpace($user, $file, $space, $properties));
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): ?ResponseInterface {
|
): ?ResponseInterface {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
|
||||||
$baseUrl = $this->featureContext->getBaseUrl();
|
$baseUrl = $this->featureContext->getBaseUrl();
|
||||||
@@ -239,7 +239,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->userLocksFileInProjectSpace($user, $file, $space, $properties);
|
$response = $this->userLocksFileInProjectSpace($user, $file, $space, $properties);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||||
@@ -259,7 +259,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $space,
|
string $space,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
|
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
|
||||||
$davPathVersion = $this->featureContext->getDavPathVersion();
|
$davPathVersion = $this->featureContext->getDavPathVersion();
|
||||||
@@ -288,7 +288,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $fileId,
|
string $fileId,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
||||||
$davPath = \rtrim($davPath, '/');
|
$davPath = \rtrim($davPath, '/');
|
||||||
@@ -311,7 +311,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $fileId,
|
string $fileId,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
||||||
$davPath = \rtrim($davPath, '/');
|
$davPath = \rtrim($davPath, '/');
|
||||||
@@ -348,7 +348,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName);
|
||||||
$response = $this->lockFile($user, $file, $properties, null, false, true, $spaceId);
|
$response = $this->lockFile($user, $file, $properties, null, false, true, $spaceId);
|
||||||
@@ -369,7 +369,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $file,
|
string $file,
|
||||||
string $fileId,
|
string $fileId,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
||||||
$davPath = \rtrim($davPath, '/');
|
$davPath = \rtrim($davPath, '/');
|
||||||
@@ -391,7 +391,7 @@ class WebDavLockingContext implements Context {
|
|||||||
"/",
|
"/",
|
||||||
$properties,
|
$properties,
|
||||||
null,
|
null,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||||
}
|
}
|
||||||
@@ -414,7 +414,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$properties,
|
$properties,
|
||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ class WebDavLockingContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function publicHasLockedFileLastSharedFolder(
|
public function publicHasLockedFileLastSharedFolder(
|
||||||
string $file,
|
string $file,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$token = ($this->featureContext->isUsingSharingNG())
|
$token = ($this->featureContext->isUsingSharingNG())
|
||||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||||
@@ -439,7 +439,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$file,
|
$file,
|
||||||
$properties,
|
$properties,
|
||||||
null,
|
null,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||||
}
|
}
|
||||||
@@ -455,7 +455,7 @@ class WebDavLockingContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function publicLocksFileLastSharedFolder(
|
public function publicLocksFileLastSharedFolder(
|
||||||
string $file,
|
string $file,
|
||||||
TableNode $properties
|
TableNode $properties,
|
||||||
): void {
|
): void {
|
||||||
$token = ($this->featureContext->isUsingSharingNG())
|
$token = ($this->featureContext->isUsingSharingNG())
|
||||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||||
@@ -466,7 +466,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$properties,
|
$properties,
|
||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -484,7 +484,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$file,
|
$file,
|
||||||
$user,
|
$user,
|
||||||
$file
|
$file,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ class WebDavLockingContext implements Context {
|
|||||||
public function userUnlocksTheLastCreatedLockOfFileInsideSpaceUsingTheWebdavApi(
|
public function userUnlocksTheLastCreatedLockOfFileInsideSpaceUsingTheWebdavApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $file
|
string $file,
|
||||||
): void {
|
): void {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName);
|
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName);
|
||||||
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||||
@@ -511,7 +511,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$file,
|
$file,
|
||||||
false,
|
false,
|
||||||
null,
|
null,
|
||||||
$spaceId
|
$spaceId,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -528,7 +528,7 @@ class WebDavLockingContext implements Context {
|
|||||||
public function userUnlocksTheLastCreatedLockOfFileWithFileIdPathUsingTheWebdavApi(
|
public function userUnlocksTheLastCreatedLockOfFileWithFileIdPathUsingTheWebdavApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $itemToUnlock,
|
string $itemToUnlock,
|
||||||
string $fileId
|
string $fileId,
|
||||||
): void {
|
): void {
|
||||||
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
||||||
$davPath = \rtrim($davPath, '/');
|
$davPath = \rtrim($davPath, '/');
|
||||||
@@ -539,7 +539,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$itemToUnlock,
|
$itemToUnlock,
|
||||||
false,
|
false,
|
||||||
$fullUrl
|
$fullUrl,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -556,13 +556,13 @@ class WebDavLockingContext implements Context {
|
|||||||
public function unlockItemWithLastLockOfOtherItemUsingWebDavAPI(
|
public function unlockItemWithLastLockOfOtherItemUsingWebDavAPI(
|
||||||
string $user,
|
string $user,
|
||||||
string $itemToUnlock,
|
string $itemToUnlock,
|
||||||
string $itemToUseLockOf
|
string $itemToUseLockOf,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||||
$user,
|
$user,
|
||||||
$itemToUnlock,
|
$itemToUnlock,
|
||||||
$user,
|
$user,
|
||||||
$itemToUseLockOf
|
$itemToUseLockOf,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -579,14 +579,14 @@ class WebDavLockingContext implements Context {
|
|||||||
public function unlockItemWithLastPublicLockOfOtherItemUsingWebDavAPI(
|
public function unlockItemWithLastPublicLockOfOtherItemUsingWebDavAPI(
|
||||||
string $user,
|
string $user,
|
||||||
string $itemToUnlock,
|
string $itemToUnlock,
|
||||||
string $itemToUseLockOf
|
string $itemToUseLockOf,
|
||||||
): void {
|
): void {
|
||||||
$lockOwner = $this->featureContext->getLastCreatedPublicShareToken();
|
$lockOwner = $this->featureContext->getLastCreatedPublicShareToken();
|
||||||
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||||
$user,
|
$user,
|
||||||
$itemToUnlock,
|
$itemToUnlock,
|
||||||
$lockOwner,
|
$lockOwner,
|
||||||
$itemToUseLockOf
|
$itemToUseLockOf,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -602,7 +602,7 @@ class WebDavLockingContext implements Context {
|
|||||||
*/
|
*/
|
||||||
private function countLockOfResources(
|
private function countLockOfResources(
|
||||||
string $user,
|
string $user,
|
||||||
string $itemToUnlock
|
string $itemToUnlock,
|
||||||
): int {
|
): int {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$baseUrl = $this->featureContext->getBaseUrl();
|
$baseUrl = $this->featureContext->getBaseUrl();
|
||||||
@@ -621,7 +621,7 @@ class WebDavLockingContext implements Context {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->getDavPathVersion()
|
$this->featureContext->getDavPathVersion(),
|
||||||
);
|
);
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
$responseXmlObject = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||||
$xmlPart = $responseXmlObject->xpath("//d:response//d:lockdiscovery/d:activelock");
|
$xmlPart = $responseXmlObject->xpath("//d:response//d:lockdiscovery/d:activelock");
|
||||||
@@ -648,7 +648,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $itemToUnlock,
|
string $itemToUnlock,
|
||||||
string $lockOwner,
|
string $lockOwner,
|
||||||
string $itemToUseLockOf,
|
string $itemToUseLockOf,
|
||||||
bool $public = false
|
bool $public = false,
|
||||||
): void {
|
): void {
|
||||||
$lockCount = $this->countLockOfResources($user, $itemToUnlock);
|
$lockCount = $this->countLockOfResources($user, $itemToUnlock);
|
||||||
|
|
||||||
@@ -657,7 +657,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$itemToUnlock,
|
$itemToUnlock,
|
||||||
$lockOwner,
|
$lockOwner,
|
||||||
$itemToUseLockOf,
|
$itemToUseLockOf,
|
||||||
$public
|
$public,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||||
|
|
||||||
@@ -666,7 +666,7 @@ class WebDavLockingContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$lockCount - 1,
|
$lockCount - 1,
|
||||||
$lockCountAfterUnlock,
|
$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])) {
|
if (!isset($this->tokenOfLastLock[$lockOwner][$itemToUseLockOf])) {
|
||||||
Assert::fail(
|
Assert::fail(
|
||||||
"could not find saved token of '$itemToUseLockOf' " .
|
"could not find saved token of '$itemToUseLockOf' " .
|
||||||
"owned by user '$lockOwner'"
|
"owned by user '$lockOwner'",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$headers = [
|
$headers = [
|
||||||
@@ -717,7 +717,7 @@ class WebDavLockingContext implements Context {
|
|||||||
"UNLOCK",
|
"UNLOCK",
|
||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$response = WebDavHelper::makeDavRequest(
|
$response = WebDavHelper::makeDavRequest(
|
||||||
@@ -730,7 +730,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$spaceId,
|
$spaceId,
|
||||||
null,
|
null,
|
||||||
$this->featureContext->getDavPathVersion(),
|
$this->featureContext->getDavPathVersion(),
|
||||||
$type
|
$type,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $response;
|
return $response;
|
||||||
@@ -750,13 +750,13 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $itemToUnlock,
|
string $itemToUnlock,
|
||||||
string $lockOwner,
|
string $lockOwner,
|
||||||
string $itemToUseLockOf
|
string $itemToUseLockOf,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||||
$user,
|
$user,
|
||||||
$itemToUnlock,
|
$itemToUnlock,
|
||||||
$lockOwner,
|
$lockOwner,
|
||||||
$itemToUseLockOf
|
$itemToUseLockOf,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -773,7 +773,7 @@ class WebDavLockingContext implements Context {
|
|||||||
public function unlockItemAsPublicWithLastLockOfUserAndItemUsingWebDavAPI(
|
public function unlockItemAsPublicWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||||
string $itemToUnlock,
|
string $itemToUnlock,
|
||||||
string $lockOwner,
|
string $lockOwner,
|
||||||
string $itemToUseLockOf
|
string $itemToUseLockOf,
|
||||||
): void {
|
): void {
|
||||||
$token = ($this->featureContext->isUsingSharingNG())
|
$token = ($this->featureContext->isUsingSharingNG())
|
||||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||||
@@ -783,7 +783,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$itemToUnlock,
|
$itemToUnlock,
|
||||||
$lockOwner,
|
$lockOwner,
|
||||||
$itemToUseLockOf,
|
$itemToUseLockOf,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -804,7 +804,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$itemToUnlock,
|
$itemToUnlock,
|
||||||
$token,
|
$token,
|
||||||
$itemToUnlock,
|
$itemToUnlock,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -823,14 +823,14 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $fileSource,
|
string $fileSource,
|
||||||
string $fileDestination,
|
string $fileDestination,
|
||||||
string $itemToUseLockOf
|
string $itemToUseLockOf,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->moveItemSendingLockTokenOfUser(
|
$response = $this->moveItemSendingLockTokenOfUser(
|
||||||
$user,
|
$user,
|
||||||
$fileSource,
|
$fileSource,
|
||||||
$fileDestination,
|
$fileDestination,
|
||||||
$itemToUseLockOf,
|
$itemToUseLockOf,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -849,13 +849,13 @@ class WebDavLockingContext implements Context {
|
|||||||
string $fileSource,
|
string $fileSource,
|
||||||
string $fileDestination,
|
string $fileDestination,
|
||||||
string $itemToUseLockOf,
|
string $itemToUseLockOf,
|
||||||
string $lockOwner
|
string $lockOwner,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$lockOwner = $this->featureContext->getActualUsername($lockOwner);
|
$lockOwner = $this->featureContext->getActualUsername($lockOwner);
|
||||||
$destination = $this->featureContext->destinationHeaderValue(
|
$destination = $this->featureContext->destinationHeaderValue(
|
||||||
$user,
|
$user,
|
||||||
$fileDestination
|
$fileDestination,
|
||||||
);
|
);
|
||||||
$token = $this->tokenOfLastLock[$lockOwner][$itemToUseLockOf];
|
$token = $this->tokenOfLastLock[$lockOwner][$itemToUseLockOf];
|
||||||
$headers = [
|
$headers = [
|
||||||
@@ -866,7 +866,7 @@ class WebDavLockingContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
"MOVE",
|
"MOVE",
|
||||||
$fileSource,
|
$fileSource,
|
||||||
$headers
|
$headers,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -886,14 +886,14 @@ class WebDavLockingContext implements Context {
|
|||||||
string $fileSource,
|
string $fileSource,
|
||||||
string $fileDestination,
|
string $fileDestination,
|
||||||
string $itemToUseLockOf,
|
string $itemToUseLockOf,
|
||||||
string $lockOwner
|
string $lockOwner,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->moveItemSendingLockTokenOfUser(
|
$response = $this->moveItemSendingLockTokenOfUser(
|
||||||
$user,
|
$user,
|
||||||
$fileSource,
|
$fileSource,
|
||||||
$fileDestination,
|
$fileDestination,
|
||||||
$itemToUseLockOf,
|
$itemToUseLockOf,
|
||||||
$lockOwner
|
$lockOwner,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -912,7 +912,7 @@ class WebDavLockingContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $content,
|
string $content,
|
||||||
string $destination,
|
string $destination,
|
||||||
string $itemToUseLockOf
|
string $itemToUseLockOf,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$token = $this->tokenOfLastLock[$user][$itemToUseLockOf];
|
$token = $this->tokenOfLastLock[$user][$itemToUseLockOf];
|
||||||
@@ -922,7 +922,7 @@ class WebDavLockingContext implements Context {
|
|||||||
"PUT",
|
"PUT",
|
||||||
$destination,
|
$destination,
|
||||||
["If" => "(<$token>)"],
|
["If" => "(<$token>)"],
|
||||||
$content
|
$content,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->setLastUploadDeleteTime(\time());
|
$this->featureContext->setLastUploadDeleteTime(\time());
|
||||||
@@ -943,7 +943,7 @@ class WebDavLockingContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$count,
|
$count,
|
||||||
$lockCount,
|
$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,
|
int $count,
|
||||||
string $file,
|
string $file,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $user
|
string $user,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->spacesContext->sendPropfindRequestToSpace($user, $spaceName, $file, null, '0');
|
$response = $this->spacesContext->sendPropfindRequestToSpace($user, $spaceName, $file, null, '0');
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||||
@@ -987,7 +987,7 @@ class WebDavLockingContext implements Context {
|
|||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$count,
|
$count,
|
||||||
$lockCount,
|
$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(
|
public function userGetsThePropertiesOfFolder(
|
||||||
string $user,
|
string $user,
|
||||||
string $path
|
string $path,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->featureContext->listFolder(
|
$response = $this->featureContext->listFolder(
|
||||||
$user,
|
$user,
|
||||||
$path,
|
$path,
|
||||||
'0'
|
'0',
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -78,12 +78,12 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function userGetsThePropertiesOfFolderWithDepth(
|
public function userGetsThePropertiesOfFolderWithDepth(
|
||||||
string $user,
|
string $user,
|
||||||
string $path,
|
string $path,
|
||||||
string $depth
|
string $depth,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->featureContext->listFolder(
|
$response = $this->featureContext->listFolder(
|
||||||
$user,
|
$user,
|
||||||
$path,
|
$path,
|
||||||
$depth
|
$depth,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $path,
|
string $path,
|
||||||
?string $spaceId,
|
?string $spaceId,
|
||||||
TableNode $propertiesTable
|
TableNode $propertiesTable,
|
||||||
): ResponseInterface {
|
): ResponseInterface {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$properties = null;
|
$properties = null;
|
||||||
@@ -132,7 +132,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function userGetsFollowingPropertiesOfEntryUsingWebDavApi(
|
public function userGetsFollowingPropertiesOfEntryUsingWebDavApi(
|
||||||
string $user,
|
string $user,
|
||||||
string $path,
|
string $path,
|
||||||
TableNode $propertiesTable
|
TableNode $propertiesTable,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->getPropertiesOfFolder($user, $path, null, $propertiesTable);
|
$response = $this->getPropertiesOfFolder($user, $path, null, $propertiesTable);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -153,7 +153,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$this->featureContext->getCurrentUser(),
|
$this->featureContext->getCurrentUser(),
|
||||||
$path,
|
$path,
|
||||||
null,
|
null,
|
||||||
$propertiesTable
|
$propertiesTable,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function userHasSetFollowingPropertiesUsingProppatch(
|
public function userHasSetFollowingPropertiesUsingProppatch(
|
||||||
string $username,
|
string $username,
|
||||||
string $path,
|
string $path,
|
||||||
TableNode $propertiesTable
|
TableNode $propertiesTable,
|
||||||
): void {
|
): void {
|
||||||
$username = $this->featureContext->getActualUsername($username);
|
$username = $this->featureContext->getActualUsername($username);
|
||||||
$this->featureContext->verifyTableNodeColumns($propertiesTable, ['propertyName', 'propertyValue']);
|
$this->featureContext->verifyTableNodeColumns($propertiesTable, ['propertyName', 'propertyValue']);
|
||||||
@@ -184,7 +184,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$this->featureContext->getPasswordForUser($username),
|
$this->featureContext->getPasswordForUser($username),
|
||||||
$path,
|
$path,
|
||||||
$properties,
|
$properties,
|
||||||
$this->featureContext->getDavPathVersion()
|
$this->featureContext->getDavPathVersion(),
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||||
}
|
}
|
||||||
@@ -202,7 +202,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function userGetsCustomPropertyOfFile(
|
public function userGetsCustomPropertyOfFile(
|
||||||
string $user,
|
string $user,
|
||||||
string $propertyName,
|
string $propertyName,
|
||||||
string $path
|
string $path,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$properties = [$propertyName];
|
$properties = [$propertyName];
|
||||||
@@ -215,7 +215,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
"0",
|
"0",
|
||||||
null,
|
null,
|
||||||
"files",
|
"files",
|
||||||
$this->featureContext->getDavPathVersion()
|
$this->featureContext->getDavPathVersion(),
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $propertyName,
|
string $propertyName,
|
||||||
string $namespace,
|
string $namespace,
|
||||||
string $path
|
string $path,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$properties = [
|
$properties = [
|
||||||
@@ -250,7 +250,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
"0",
|
"0",
|
||||||
null,
|
null,
|
||||||
"files",
|
"files",
|
||||||
$this->featureContext->getDavPathVersion()
|
$this->featureContext->getDavPathVersion(),
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
'0',
|
'0',
|
||||||
$properties,
|
$properties,
|
||||||
null,
|
null,
|
||||||
"public-files"
|
"public-files",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function thePublicGetsFollowingPropertiesOfEntryFromLastLinkShare(
|
public function thePublicGetsFollowingPropertiesOfEntryFromLastLinkShare(
|
||||||
string $path,
|
string $path,
|
||||||
TableNode $propertiesTable
|
TableNode $propertiesTable,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->getPropertiesOfEntryFromLastLinkShare($path, $propertiesTable);
|
$response = $this->getPropertiesOfEntryFromLastLinkShare($path, $propertiesTable);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
@@ -323,7 +323,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$propertyName,
|
$propertyName,
|
||||||
$propertyValue,
|
$propertyValue,
|
||||||
$namespace,
|
$namespace,
|
||||||
$this->featureContext->getDavPathVersion()
|
$this->featureContext->getDavPathVersion(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,13 +342,13 @@ class WebDavPropertiesContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $propertyName,
|
string $propertyName,
|
||||||
string $path,
|
string $path,
|
||||||
string $propertyValue
|
string $propertyValue,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->setResourceProperty(
|
$response = $this->setResourceProperty(
|
||||||
$user,
|
$user,
|
||||||
$propertyName,
|
$propertyName,
|
||||||
$path,
|
$path,
|
||||||
$propertyValue
|
$propertyValue,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -370,14 +370,14 @@ class WebDavPropertiesContext implements Context {
|
|||||||
string $propertyName,
|
string $propertyName,
|
||||||
string $namespace,
|
string $namespace,
|
||||||
string $path,
|
string $path,
|
||||||
string $propertyValue
|
string $propertyValue,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->setResourceProperty(
|
$response = $this->setResourceProperty(
|
||||||
$user,
|
$user,
|
||||||
$propertyName,
|
$propertyName,
|
||||||
$path,
|
$path,
|
||||||
$propertyValue,
|
$propertyValue,
|
||||||
$namespace
|
$namespace,
|
||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
}
|
}
|
||||||
@@ -397,13 +397,13 @@ class WebDavPropertiesContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $propertyName,
|
string $propertyName,
|
||||||
string $path,
|
string $path,
|
||||||
string $propertyValue
|
string $propertyValue,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->setResourceProperty(
|
$response = $this->setResourceProperty(
|
||||||
$user,
|
$user,
|
||||||
$propertyName,
|
$propertyName,
|
||||||
$path,
|
$path,
|
||||||
$propertyValue
|
$propertyValue,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||||
}
|
}
|
||||||
@@ -425,14 +425,14 @@ class WebDavPropertiesContext implements Context {
|
|||||||
string $propertyName,
|
string $propertyName,
|
||||||
string $namespace,
|
string $namespace,
|
||||||
string $path,
|
string $path,
|
||||||
string $propertyValue
|
string $propertyValue,
|
||||||
): void {
|
): void {
|
||||||
$response = $this->setResourceProperty(
|
$response = $this->setResourceProperty(
|
||||||
$user,
|
$user,
|
||||||
$propertyName,
|
$propertyName,
|
||||||
$path,
|
$path,
|
||||||
$propertyValue,
|
$propertyValue,
|
||||||
$namespace
|
$namespace,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||||
}
|
}
|
||||||
@@ -450,21 +450,21 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$propertyValue = \str_replace('\"', '"', $propertyValue);
|
$propertyValue = \str_replace('\"', '"', $propertyValue);
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$xmlPart = $responseXmlObject->xpath(
|
$xmlPart = $responseXmlObject->xpath(
|
||||||
"//d:prop/" . "$propertyName"
|
"//d:prop/" . "$propertyName",
|
||||||
);
|
);
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
0,
|
0,
|
||||||
$xmlPart,
|
$xmlPart,
|
||||||
"Cannot find property \"$propertyName\""
|
"Cannot find property \"$propertyName\"",
|
||||||
);
|
);
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$propertyValue,
|
$propertyValue,
|
||||||
$xmlPart[0]->__toString(),
|
$xmlPart[0]->__toString(),
|
||||||
"\"$propertyName\" has a value \"" .
|
"\"$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(
|
public function theResponseShouldContainACustomPropertyWithNamespaceAndValue(
|
||||||
string $propertyName,
|
string $propertyName,
|
||||||
string $namespaceString,
|
string $namespaceString,
|
||||||
string $propertyValue
|
string $propertyValue,
|
||||||
): void {
|
): void {
|
||||||
// let's unescape quotes first
|
// let's unescape quotes first
|
||||||
$propertyValue = \str_replace('\"', '"', $propertyValue);
|
$propertyValue = \str_replace('\"', '"', $propertyValue);
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$ns = WebDavHelper::parseNamespace($namespaceString);
|
$ns = WebDavHelper::parseNamespace($namespaceString);
|
||||||
$responseXmlObject->registerXPathNamespace(
|
$responseXmlObject->registerXPathNamespace(
|
||||||
$ns->prefix,
|
$ns->prefix,
|
||||||
$ns->namespace
|
$ns->namespace,
|
||||||
);
|
);
|
||||||
$xmlPart = $responseXmlObject->xpath(
|
$xmlPart = $responseXmlObject->xpath(
|
||||||
"//d:prop/$propertyName"
|
"//d:prop/$propertyName",
|
||||||
);
|
);
|
||||||
Assert::assertArrayHasKey(
|
Assert::assertArrayHasKey(
|
||||||
0,
|
0,
|
||||||
$xmlPart,
|
$xmlPart,
|
||||||
"Cannot find property \"$propertyName\""
|
"Cannot find property \"$propertyName\"",
|
||||||
);
|
);
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$propertyValue,
|
$propertyValue,
|
||||||
$xmlPart[0]->__toString(),
|
$xmlPart[0]->__toString(),
|
||||||
"\"$propertyName\" has a value \"" .
|
"\"$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(
|
public function theSingleResponseShouldContainAPropertyWithChildProperty(
|
||||||
string $property,
|
string $property,
|
||||||
string $withOrWithout,
|
string $withOrWithout,
|
||||||
string $childProperty
|
string $childProperty,
|
||||||
): void {
|
): void {
|
||||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
||||||
"//d:prop/$property/$childProperty"
|
"//d:prop/$property/$childProperty",
|
||||||
);
|
);
|
||||||
if ($withOrWithout === "with") {
|
if ($withOrWithout === "with") {
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
isset($xmlPart[0]),
|
isset($xmlPart[0]),
|
||||||
"Cannot find property \"$property/$childProperty\""
|
"Cannot find property \"$property/$childProperty\"",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
isset($xmlPart[0]),
|
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 {
|
public function theResponseShouldContainProperty(string $key): void {
|
||||||
$this->checkResponseContainsProperty(
|
$this->checkResponseContainsProperty(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
$key
|
$key,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,7 +570,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$this->checkResponseContainsProperty(
|
$this->checkResponseContainsProperty(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
$key,
|
$key,
|
||||||
$namespace
|
$namespace,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,13 +585,13 @@ class WebDavPropertiesContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theSingleResponseShouldContainAPropertyWithValue(
|
public function theSingleResponseShouldContainAPropertyWithValue(
|
||||||
string $key,
|
string $key,
|
||||||
string $expectedValue
|
string $expectedValue,
|
||||||
): void {
|
): void {
|
||||||
$this->checkResponseContainsAPropertyWithValue(
|
$this->checkResponseContainsAPropertyWithValue(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
$key,
|
$key,
|
||||||
$expectedValue,
|
$expectedValue,
|
||||||
$expectedValue
|
$expectedValue,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,14 +608,14 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function theSingleResponseAboutTheFileOwnedByShouldContainAPropertyWithValue(
|
public function theSingleResponseAboutTheFileOwnedByShouldContainAPropertyWithValue(
|
||||||
string $user,
|
string $user,
|
||||||
string $key,
|
string $key,
|
||||||
string $expectedValue
|
string $expectedValue,
|
||||||
): void {
|
): void {
|
||||||
$this->checkResponseContainsAPropertyWithValue(
|
$this->checkResponseContainsAPropertyWithValue(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
$key,
|
$key,
|
||||||
$expectedValue,
|
$expectedValue,
|
||||||
$expectedValue,
|
$expectedValue,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,13 +632,13 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function theSingleResponseShouldContainAPropertyWithValueAndAlternative(
|
public function theSingleResponseShouldContainAPropertyWithValueAndAlternative(
|
||||||
string $key,
|
string $key,
|
||||||
string $expectedValue,
|
string $expectedValue,
|
||||||
string $altExpectedValue
|
string $altExpectedValue,
|
||||||
): void {
|
): void {
|
||||||
$this->checkResponseContainsAPropertyWithValue(
|
$this->checkResponseContainsAPropertyWithValue(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
$key,
|
$key,
|
||||||
$expectedValue,
|
$expectedValue,
|
||||||
$altExpectedValue
|
$altExpectedValue,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,7 +653,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function checkResponseContainsProperty(
|
public function checkResponseContainsProperty(
|
||||||
ResponseInterface $response,
|
ResponseInterface $response,
|
||||||
string $key,
|
string $key,
|
||||||
string $namespaceString = null
|
string $namespaceString = null,
|
||||||
): SimpleXMLElement {
|
): SimpleXMLElement {
|
||||||
$xmlPart = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
$xmlPart = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||||
;
|
;
|
||||||
@@ -662,7 +662,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$ns = WebDavHelper::parseNamespace($namespaceString);
|
$ns = WebDavHelper::parseNamespace($namespaceString);
|
||||||
$xmlPart->registerXPathNamespace(
|
$xmlPart->registerXPathNamespace(
|
||||||
$ns->prefix,
|
$ns->prefix,
|
||||||
$ns->namespace
|
$ns->namespace,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,14 +670,14 @@ class WebDavPropertiesContext implements Context {
|
|||||||
|
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
isset($match[0]),
|
isset($match[0]),
|
||||||
"Cannot find property \"$key\""
|
"Cannot find property \"$key\"",
|
||||||
);
|
);
|
||||||
|
|
||||||
$property = \explode(":", $key);
|
$property = \explode(":", $key);
|
||||||
$propertyName = $property[\count($property) - 1];
|
$propertyName = $property[\count($property) - 1];
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$match[0]->getName(),
|
$match[0]->getName(),
|
||||||
$propertyName
|
$propertyName,
|
||||||
);
|
);
|
||||||
return $match[0];
|
return $match[0];
|
||||||
}
|
}
|
||||||
@@ -697,13 +697,13 @@ class WebDavPropertiesContext implements Context {
|
|||||||
string $key,
|
string $key,
|
||||||
string $expectedValue,
|
string $expectedValue,
|
||||||
string $altExpectedValue,
|
string $altExpectedValue,
|
||||||
?string $user = null
|
?string $user = null,
|
||||||
): void {
|
): void {
|
||||||
$xmlPart = $this->checkResponseContainsProperty($response, $key);
|
$xmlPart = $this->checkResponseContainsProperty($response, $key);
|
||||||
$value = $xmlPart->__toString();
|
$value = $xmlPart->__toString();
|
||||||
$expectedValue = $this->featureContext->substituteInLineCodes(
|
$expectedValue = $this->featureContext->substituteInLineCodes(
|
||||||
$expectedValue,
|
$expectedValue,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
$expectedValue = "#^$expectedValue$#";
|
$expectedValue = "#^$expectedValue$#";
|
||||||
$altExpectedValue = "#^$altExpectedValue$#";
|
$altExpectedValue = "#^$altExpectedValue$#";
|
||||||
@@ -712,7 +712,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
) {
|
) {
|
||||||
Assert::fail(
|
Assert::fail(
|
||||||
"Property \"$key\" found with value \"$value\", " .
|
"Property \"$key\" found with value \"$value\", " .
|
||||||
"expected \"$expectedValue\" or \"$altExpectedValue\""
|
"expected \"$expectedValue\" or \"$altExpectedValue\"",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -730,7 +730,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$this->assertValueOfItemInResponseAboutUserIs(
|
$this->assertValueOfItemInResponseAboutUserIs(
|
||||||
$xpath,
|
$xpath,
|
||||||
null,
|
null,
|
||||||
$expectedValue
|
$expectedValue,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,7 +753,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$this->assertValueOfItemInResponseAboutUserIs(
|
$this->assertValueOfItemInResponseAboutUserIs(
|
||||||
$fullXpath,
|
$fullXpath,
|
||||||
null,
|
null,
|
||||||
$expectedValue
|
$expectedValue,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -770,7 +770,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function theValueOfTheItemInTheResponseAboutUserShouldBe(
|
public function theValueOfTheItemInTheResponseAboutUserShouldBe(
|
||||||
string $xpath,
|
string $xpath,
|
||||||
string $user,
|
string $user,
|
||||||
string $expectedValue
|
string $expectedValue,
|
||||||
): void {
|
): void {
|
||||||
$this->assertValueOfItemInResponseAboutUserIs($xpath, $user, $expectedValue);
|
$this->assertValueOfItemInResponseAboutUserIs($xpath, $user, $expectedValue);
|
||||||
}
|
}
|
||||||
@@ -785,13 +785,13 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function assertValueOfItemInResponseAboutUserIs(string $xpath, ?string $user, string $expectedValue): void {
|
public function assertValueOfItemInResponseAboutUserIs(string $xpath, ?string $user, string $expectedValue): void {
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$value = $this->getXmlItemByXpath($responseXmlObject, $xpath);
|
$value = $this->getXmlItemByXpath($responseXmlObject, $xpath);
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$expectedValue = $this->featureContext->substituteInLineCodes(
|
$expectedValue = $this->featureContext->substituteInLineCodes(
|
||||||
$expectedValue,
|
$expectedValue,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
|
|
||||||
// The expected value can contain /%base_path%/ which can be empty some time
|
// The expected value can contain /%base_path%/ which can be empty some time
|
||||||
@@ -801,7 +801,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$expectedValue,
|
$expectedValue,
|
||||||
$value,
|
$value,
|
||||||
"item \"$xpath\" found with value \"$value\", " .
|
"item \"$xpath\" found with value \"$value\", " .
|
||||||
"expected \"$expectedValue\""
|
"expected \"$expectedValue\"",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,25 +820,25 @@ class WebDavPropertiesContext implements Context {
|
|||||||
string $xpath,
|
string $xpath,
|
||||||
?string $user,
|
?string $user,
|
||||||
string $expectedValue1,
|
string $expectedValue1,
|
||||||
string $expectedValue2
|
string $expectedValue2,
|
||||||
): void {
|
): void {
|
||||||
if (!$expectedValue2) {
|
if (!$expectedValue2) {
|
||||||
$expectedValue2 = $expectedValue1;
|
$expectedValue2 = $expectedValue1;
|
||||||
}
|
}
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
$value = $this->getXmlItemByXpath($responseXmlObject, $xpath);
|
$value = $this->getXmlItemByXpath($responseXmlObject, $xpath);
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$expectedValue1 = $this->featureContext->substituteInLineCodes(
|
$expectedValue1 = $this->featureContext->substituteInLineCodes(
|
||||||
$expectedValue1,
|
$expectedValue1,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
|
|
||||||
$expectedValue2 = $this->featureContext->substituteInLineCodes(
|
$expectedValue2 = $this->featureContext->substituteInLineCodes(
|
||||||
$expectedValue2,
|
$expectedValue2,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
|
|
||||||
// The expected value can contain /%base_path%/ which can be empty some time
|
// 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);
|
$isExpectedValueInMessage = \in_array($value, $expectedValues);
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$isExpectedValueInMessage,
|
$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(
|
public function getXmlItemByXpath(
|
||||||
SimpleXMLElement $responseXmlObject,
|
SimpleXMLElement $responseXmlObject,
|
||||||
string $xpath
|
string $xpath,
|
||||||
): string {
|
): string {
|
||||||
$xmlPart = $responseXmlObject->xpath($xpath);
|
$xmlPart = $responseXmlObject->xpath($xpath);
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
isset($xmlPart[0]),
|
isset($xmlPart[0]),
|
||||||
"Cannot find item with xpath \"$xpath\""
|
"Cannot find item with xpath \"$xpath\"",
|
||||||
);
|
);
|
||||||
return $xmlPart[0]->__toString();
|
return $xmlPart[0]->__toString();
|
||||||
}
|
}
|
||||||
@@ -884,7 +884,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$this->assertXpathValueMatchesPattern(
|
$this->assertXpathValueMatchesPattern(
|
||||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
||||||
$xpath,
|
$xpath,
|
||||||
$pattern
|
$pattern,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -901,7 +901,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function publicGetsThePropertiesOfFolderAndAssertValueOfItemInResponseRegExp(
|
public function publicGetsThePropertiesOfFolderAndAssertValueOfItemInResponseRegExp(
|
||||||
string $xpath,
|
string $xpath,
|
||||||
string $path,
|
string $path,
|
||||||
string $pattern
|
string $pattern,
|
||||||
): void {
|
): void {
|
||||||
$propertiesTable = new TableNode([['propertyName'],['d:lockdiscovery']]);
|
$propertiesTable = new TableNode([['propertyName'],['d:lockdiscovery']]);
|
||||||
$response = $this->getPropertiesOfEntryFromLastLinkShare($path, $propertiesTable);
|
$response = $this->getPropertiesOfEntryFromLastLinkShare($path, $propertiesTable);
|
||||||
@@ -909,7 +909,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$this->assertXpathValueMatchesPattern(
|
$this->assertXpathValueMatchesPattern(
|
||||||
HttpRequestHelper::getResponseXml($response, __METHOD__),
|
HttpRequestHelper::getResponseXml($response, __METHOD__),
|
||||||
$xpath,
|
$xpath,
|
||||||
$pattern
|
$pattern,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -925,14 +925,14 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function assertEntryWithHrefMatchingRegExpInResponseToUser(string $expectedHref, string $user): void {
|
public function assertEntryWithHrefMatchingRegExpInResponseToUser(string $expectedHref, string $user): void {
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||||
$this->featureContext->getResponse(),
|
$this->featureContext->getResponse(),
|
||||||
__METHOD__
|
__METHOD__,
|
||||||
);
|
);
|
||||||
|
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$expectedHref = $this->featureContext->substituteInLineCodes(
|
$expectedHref = $this->featureContext->substituteInLineCodes(
|
||||||
$expectedHref,
|
$expectedHref,
|
||||||
$user,
|
$user,
|
||||||
['preg_quote' => ['/']]
|
['preg_quote' => ['/']],
|
||||||
);
|
);
|
||||||
$expectedHref = WebdavHelper::prefixRemotePhp($expectedHref);
|
$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
|
// If we have run out of entries in the response, then fail the test
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
isset($xmlPart[0]),
|
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();
|
$value = $xmlPart[0]->__toString();
|
||||||
$decodedValue = \rawurldecode($value);
|
$decodedValue = \rawurldecode($value);
|
||||||
@@ -985,12 +985,12 @@ class WebDavPropertiesContext implements Context {
|
|||||||
SimpleXMLElement $responseXmlObject,
|
SimpleXMLElement $responseXmlObject,
|
||||||
string $xpath,
|
string $xpath,
|
||||||
string $pattern,
|
string $pattern,
|
||||||
?string $user = null
|
?string $user = null,
|
||||||
): void {
|
): void {
|
||||||
$xmlPart = $responseXmlObject->xpath($xpath);
|
$xmlPart = $responseXmlObject->xpath($xpath);
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
isset($xmlPart[0]),
|
isset($xmlPart[0]),
|
||||||
"Cannot find item with xpath \"$xpath\""
|
"Cannot find item with xpath \"$xpath\"",
|
||||||
);
|
);
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$value = $xmlPart[0]->__toString();
|
$value = $xmlPart[0]->__toString();
|
||||||
@@ -1015,13 +1015,13 @@ class WebDavPropertiesContext implements Context {
|
|||||||
[$this->featureContext, $callback],
|
[$this->featureContext, $callback],
|
||||||
"parameter" => [],
|
"parameter" => [],
|
||||||
],
|
],
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
Assert::assertMatchesRegularExpression(
|
Assert::assertMatchesRegularExpression(
|
||||||
$pattern,
|
$pattern,
|
||||||
$value,
|
$value,
|
||||||
"item \"$xpath\" found with value \"$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 $user,
|
||||||
string $xpath,
|
string $xpath,
|
||||||
string $path,
|
string $path,
|
||||||
string $pattern
|
string $pattern,
|
||||||
): void {
|
): void {
|
||||||
$propertiesTable = new TableNode([['propertyName'],['d:lockdiscovery']]);
|
$propertiesTable = new TableNode([['propertyName'],['d:lockdiscovery']]);
|
||||||
$response = $this->getPropertiesOfFolder(
|
$response = $this->getPropertiesOfFolder(
|
||||||
$user,
|
$user,
|
||||||
$path,
|
$path,
|
||||||
null,
|
null,
|
||||||
$propertiesTable
|
$propertiesTable,
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe('207', '', $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe('207', '', $response);
|
||||||
$this->assertXpathValueMatchesPattern(
|
$this->assertXpathValueMatchesPattern(
|
||||||
HttpRequestHelper::getResponseXml($response, __METHOD__),
|
HttpRequestHelper::getResponseXml($response, __METHOD__),
|
||||||
$xpath,
|
$xpath,
|
||||||
$pattern,
|
$pattern,
|
||||||
$user
|
$user,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1070,7 +1070,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath($xpath);
|
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath($xpath);
|
||||||
Assert::assertFalse(
|
Assert::assertFalse(
|
||||||
isset($xmlPart[0]),
|
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 $path,
|
||||||
string $property,
|
string $property,
|
||||||
string $expectedValue,
|
string $expectedValue,
|
||||||
?string $altExpectedValue = null
|
?string $altExpectedValue = null,
|
||||||
): void {
|
): void {
|
||||||
$this->checkPropertyOfAFolder($user, $path, $property, $expectedValue, $altExpectedValue);
|
$this->checkPropertyOfAFolder($user, $path, $property, $expectedValue, $altExpectedValue);
|
||||||
}
|
}
|
||||||
@@ -1128,7 +1128,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$response,
|
$response,
|
||||||
$property,
|
$property,
|
||||||
$expectedValue,
|
$expectedValue,
|
||||||
$altExpectedValue
|
$altExpectedValue,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1143,20 +1143,20 @@ class WebDavPropertiesContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theSingleResponseShouldContainAPropertyWithValueLike(
|
public function theSingleResponseShouldContainAPropertyWithValueLike(
|
||||||
string $key,
|
string $key,
|
||||||
string $regex
|
string $regex,
|
||||||
): void {
|
): void {
|
||||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
||||||
"//d:prop/$key"
|
"//d:prop/$key",
|
||||||
);
|
);
|
||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
isset($xmlPart[0]),
|
isset($xmlPart[0]),
|
||||||
"Cannot find property \"$key\""
|
"Cannot find property \"$key\"",
|
||||||
);
|
);
|
||||||
$value = $xmlPart[0]->__toString();
|
$value = $xmlPart[0]->__toString();
|
||||||
Assert::assertMatchesRegularExpression(
|
Assert::assertMatchesRegularExpression(
|
||||||
$regex,
|
$regex,
|
||||||
$value,
|
$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);
|
$this->featureContext->verifyTableNodeColumnsCount($table, 1);
|
||||||
WebdavTest::assertResponseContainsShareTypes(
|
WebdavTest::assertResponseContainsShareTypes(
|
||||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
||||||
$table->getRows()
|
$table->getRows(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1186,16 +1186,16 @@ class WebDavPropertiesContext implements Context {
|
|||||||
*/
|
*/
|
||||||
public function theResponseShouldContainAnEmptyProperty(string $property): void {
|
public function theResponseShouldContainAnEmptyProperty(string $property): void {
|
||||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
||||||
"//d:prop/$property"
|
"//d:prop/$property",
|
||||||
);
|
);
|
||||||
Assert::assertCount(
|
Assert::assertCount(
|
||||||
1,
|
1,
|
||||||
$xmlPart,
|
$xmlPart,
|
||||||
"Cannot find property \"$property\""
|
"Cannot find property \"$property\"",
|
||||||
);
|
);
|
||||||
Assert::assertEmpty(
|
Assert::assertEmpty(
|
||||||
$xmlPart[0],
|
$xmlPart[0],
|
||||||
"Property \"$property\" is not empty"
|
"Property \"$property\" is not empty",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1212,7 +1212,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $path,
|
string $path,
|
||||||
?string $storePath = "",
|
?string $storePath = "",
|
||||||
?string $spaceId = null
|
?string $spaceId = null,
|
||||||
): SimpleXMLElement {
|
): SimpleXMLElement {
|
||||||
if ($storePath === "") {
|
if ($storePath === "") {
|
||||||
$storePath = $path;
|
$storePath = $path;
|
||||||
@@ -1223,7 +1223,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$path,
|
$path,
|
||||||
$spaceId,
|
$spaceId,
|
||||||
$propertiesTable
|
$propertiesTable,
|
||||||
);
|
);
|
||||||
$xmlObject = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
$xmlObject = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||||
$this->storedETAG[$user][$storePath]
|
$this->storedETAG[$user][$storePath]
|
||||||
@@ -1243,7 +1243,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function userStoresEtagOfElement(string $user, string $path): void {
|
public function userStoresEtagOfElement(string $user, string $path): void {
|
||||||
$this->storeEtagOfElement(
|
$this->storeEtagOfElement(
|
||||||
$user,
|
$user,
|
||||||
$path
|
$path,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1262,7 +1262,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$this->storeEtagOfElement(
|
$this->storeEtagOfElement(
|
||||||
$user,
|
$user,
|
||||||
$path,
|
$path,
|
||||||
$storePath
|
$storePath,
|
||||||
);
|
);
|
||||||
if ($storePath == "") {
|
if ($storePath == "") {
|
||||||
$storePath = $path;
|
$storePath = $path;
|
||||||
@@ -1285,7 +1285,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$this->storeEtagOfElement(
|
$this->storeEtagOfElement(
|
||||||
$user,
|
$user,
|
||||||
$path
|
$path,
|
||||||
);
|
);
|
||||||
if ($this->storedETAG[$user][$path] === "" || $this->storedETAG[$user][$path] === null) {
|
if ($this->storedETAG[$user][$path] === "" || $this->storedETAG[$user][$path] === null) {
|
||||||
throw new Exception("Expected stored etag to be some string but found null!");
|
throw new Exception("Expected stored etag to be some string but found null!");
|
||||||
@@ -1302,7 +1302,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
Assert::assertTrue(
|
Assert::assertTrue(
|
||||||
$this->featureContext->isEtagValid($this->featureContext->getEtagFromResponseXmlObject()),
|
$this->featureContext->isEtagValid($this->featureContext->getEtagFromResponseXmlObject()),
|
||||||
__METHOD__
|
__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 {
|
public function theResponseShouldHavePropertyWithValue(string $username, TableNode $expectedPropTable): void {
|
||||||
$this->featureContext->verifyTableNodeColumns(
|
$this->featureContext->verifyTableNodeColumns(
|
||||||
$expectedPropTable,
|
$expectedPropTable,
|
||||||
['resource', 'propertyName', 'propertyValue']
|
['resource', 'propertyName', 'propertyValue'],
|
||||||
);
|
);
|
||||||
$responseXmlObject = HttpRequestHelper::getResponseXml($this->featureContext->getResponse());
|
$responseXmlObject = HttpRequestHelper::getResponseXml($this->featureContext->getResponse());
|
||||||
|
|
||||||
@@ -1356,7 +1356,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$col["propertyValue"],
|
$col["propertyValue"],
|
||||||
$xmlPart[0],
|
$xmlPart[0],
|
||||||
__METHOD__
|
__METHOD__
|
||||||
. " Expected '" . $col["propertyValue"] . "' but got '" . $xmlPart[0] . "'"
|
. " Expected '" . $col["propertyValue"] . "' but got '" . $xmlPart[0] . "'",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1375,10 +1375,10 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$path,
|
$path,
|
||||||
null,
|
null,
|
||||||
$propertiesTable
|
$propertiesTable,
|
||||||
);
|
);
|
||||||
return $this->featureContext->getEtagFromResponseXmlObject(
|
return $this->featureContext->getEtagFromResponseXmlObject(
|
||||||
HttpRequestHelper::getResponseXml($response, __METHOD__)
|
HttpRequestHelper::getResponseXml($response, __METHOD__),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1397,14 +1397,14 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$user,
|
$user,
|
||||||
$this->storedETAG,
|
$this->storedETAG,
|
||||||
$messageStart
|
$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(
|
Assert::assertArrayHasKey(
|
||||||
$path,
|
$path,
|
||||||
$this->storedETAG[$user],
|
$this->storedETAG[$user],
|
||||||
$messageStart
|
$messageStart
|
||||||
. " Trying to check etag of element $path of user "
|
. " 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];
|
return $this->storedETAG[$user][$path];
|
||||||
}
|
}
|
||||||
@@ -1478,7 +1478,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
public function etagOfElementOfUserShouldOrShouldNotHaveChanged(
|
public function etagOfElementOfUserShouldOrShouldNotHaveChanged(
|
||||||
string $path,
|
string $path,
|
||||||
string $user,
|
string $user,
|
||||||
string $shouldShouldNot
|
string $shouldShouldNot,
|
||||||
): void {
|
): void {
|
||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$actualEtag = $this->getCurrentEtagOfElement($path, $user);
|
$actualEtag = $this->getCurrentEtagOfElement($path, $user);
|
||||||
@@ -1489,7 +1489,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$actualEtag,
|
$actualEtag,
|
||||||
__METHOD__
|
__METHOD__
|
||||||
. " The etag of element '$path' of user '$user' was not expected to change."
|
. " 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 {
|
} else {
|
||||||
Assert::assertNotEquals(
|
Assert::assertNotEquals(
|
||||||
@@ -1497,7 +1497,7 @@ class WebDavPropertiesContext implements Context {
|
|||||||
$actualEtag,
|
$actualEtag,
|
||||||
__METHOD__
|
__METHOD__
|
||||||
. " The etag of element '$path' of user '$user' was expected to change."
|
. " 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