mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-13 00:52:01 -04:00
steps refactoring
This commit is contained in:
5
.vscode/extensions.json
vendored
Normal file
5
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"alexkrechik.cucumberautocomplete"
|
||||
]
|
||||
}
|
||||
16
.vscode/settings.json
vendored
Normal file
16
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"cucumberautocomplete.steps": [
|
||||
"tests/acceptance/bootstrap/*.php"
|
||||
],
|
||||
"cucumberautocomplete.syncfeatures": "tests/acceptance/features/**/*.feature",
|
||||
"cucumberautocomplete.strictGherkinCompletion": false,
|
||||
"cucumberautocomplete.strictGherkinValidation": false,
|
||||
"cucumberautocomplete.customParameters": [
|
||||
{ "parameter": ":string", "value": "\"([^\"]*)\"" },
|
||||
{ "parameter": "'/\\^(.*)\\$/'", "value": "'^$1$$'", "isRegex": true, "flags": "g" },
|
||||
{ "parameter": "\\$\\w+", "value": "(.*)", "isRegex": true, "flags": "g" },
|
||||
{ "parameter": "(?<!\\?):[a-zA-Z_][a-zA-Z0-9_]*", "value": "\"([^\"]*)\"", "isRegex": true, "flags": "g" }
|
||||
],
|
||||
"cucumberautocomplete.gherkinDefinitionPart": "(Given|When|Then|But)\\(",
|
||||
"cucumberautocomplete.pureTextSteps": false
|
||||
}
|
||||
5
Makefile
5
Makefile
@@ -107,6 +107,7 @@ help:
|
||||
@echo -e "${GREEN}Tools for linting gherkin feature files:\n${RESET}"
|
||||
@echo -e "\tmake test-gherkin-lint\t\t${BLUE}run lint checks on Gherkin feature files${RESET}"
|
||||
@echo -e "\tmake test-gherkin-lint-fix\t${BLUE}apply lint fixes to gherkin feature files${RESET}"
|
||||
@echo -e "\tmake find-unused-steps\t\t${BLUE}list Behat step definitions unused by any .feature file${RESET}"
|
||||
@echo
|
||||
|
||||
.PHONY: clean-tests
|
||||
@@ -228,6 +229,10 @@ test-gherkin-lint:
|
||||
test-gherkin-lint-fix:
|
||||
gherlint --fix tests/acceptance/features -c tests/acceptance/config/.gherlintrc.json
|
||||
|
||||
.PHONY: find-unused-steps
|
||||
find-unused-steps: vendor-bin/behat/vendor
|
||||
tests/acceptance/scripts/find-unused-steps.sh
|
||||
|
||||
.PHONY: bingo-update
|
||||
bingo-update: $(BINGO)
|
||||
$(BINGO) get -l -v -t 20
|
||||
|
||||
@@ -86,5 +86,6 @@
|
||||
<property name="lineLimit" value="120" />
|
||||
<property name="absoluteLineLimit" value="120" />
|
||||
</properties>
|
||||
<exclude-pattern>*/tests/acceptance/bootstrap/*</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
||||
@@ -29,6 +29,8 @@ use Psr\Http\Message\ResponseInterface;
|
||||
use splitbrain\PHPArchive\Tar;
|
||||
use splitbrain\PHPArchive\Zip;
|
||||
use splitbrain\PHPArchive\Archive;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -133,7 +135,6 @@ class ArchiverContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" downloads the (zip|tar) archive of "([^"]*)" using the resource (id|ids|path|paths) and setting these headers:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $archiveType
|
||||
@@ -146,6 +147,7 @@ class ArchiverContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" downloads the (zip|tar) archive of "([^"]*)" using the resource (id|ids|path|paths) and setting these headers:$/')]
|
||||
public function userDownloadsTheZipOrTarArchiveOfResourceUsingResourceIdOrPathAndSettingTheseHeaders(
|
||||
string $user,
|
||||
string $archiveType,
|
||||
@@ -167,7 +169,6 @@ class ArchiverContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :downloader downloads the archive of :item of user :owner using the resource :addressType
|
||||
*
|
||||
* @param string $downloader Who sends the request
|
||||
* @param string $resource
|
||||
@@ -179,6 +180,7 @@ class ArchiverContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :downloader downloads the archive of :item of user :owner using the resource :addressType')]
|
||||
public function userDownloadsTheArchiveOfItemOfUser(
|
||||
string $downloader,
|
||||
string $resource,
|
||||
@@ -224,7 +226,6 @@ class ArchiverContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user downloads the archive of these items using the resource :addressType
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $addressType ids|paths
|
||||
@@ -234,6 +235,7 @@ class ArchiverContext implements Context {
|
||||
*
|
||||
* @throws GuzzleException|Exception
|
||||
*/
|
||||
#[When('user :user downloads the archive of these items using the resource :addressType')]
|
||||
public function userDownloadsTheArchiveOfTheseItems(
|
||||
string $user,
|
||||
string $addressType,
|
||||
@@ -257,7 +259,6 @@ class ArchiverContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the downloaded :type archive should contain these files:
|
||||
*
|
||||
* @param string $type
|
||||
* @param TableNode $expectedFiles
|
||||
@@ -266,6 +267,7 @@ class ArchiverContext implements Context {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the downloaded :type archive should contain these files:')]
|
||||
public function theDownloadedArchiveShouldContainTheseFiles(string $type, TableNode $expectedFiles): void {
|
||||
$this->featureContext->verifyTableNodeColumns($expectedFiles, ['name', 'content']);
|
||||
$contents = $this->featureContext->getResponse()->getBody()->getContents();
|
||||
|
||||
@@ -22,6 +22,8 @@ use Behat\Behat\Context\Context;
|
||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
use TestHelpers\BehatHelper;
|
||||
use TestHelpers\AuthAppHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -46,13 +48,13 @@ class AuthAppContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user creates app token with expiration time :expiration using the auth-app API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $expiration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user creates app token with expiration time :expiration using the auth-app API')]
|
||||
public function userCreatesAppTokenWithExpirationTimeUsingTheAuthAppApi(string $user, string $expiration): void {
|
||||
$this->featureContext->setResponse(
|
||||
AuthAppHelper::createAppAuthToken(
|
||||
@@ -65,13 +67,13 @@ class AuthAppContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has created app token with expiration time :expiration using the auth-app API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $expiration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has created app token with expiration time :expiration using the auth-app API')]
|
||||
public function userHasCreatedAppTokenWithExpirationTime(string $user, string $expiration): void {
|
||||
$response = AuthAppHelper::createAppAuthToken(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
@@ -83,12 +85,12 @@ class AuthAppContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user lists all created tokens using the auth-app API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user lists all created tokens using the auth-app API')]
|
||||
public function userListsAllCreatedTokensUsingTheAuthAppApi(string $user): void {
|
||||
$this->featureContext->setResponse(
|
||||
AuthAppHelper::listAllAppAuthTokensForUser(
|
||||
@@ -100,13 +102,13 @@ class AuthAppContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the administrator has created app token for user :impersonatedUser with expiration time :expiration using the auth-app API
|
||||
*
|
||||
* @param string $impersonatedUser
|
||||
* @param string $expiration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('the administrator has created app token for user :impersonatedUser with expiration time :expiration using the auth-app API')]
|
||||
public function theAdministratorHasCreatedAppTokenWithExpirationTimeImpersonatingUserUsingTheAuthAppApi(
|
||||
string $impersonatedUser,
|
||||
string $expiration,
|
||||
@@ -129,13 +131,13 @@ class AuthAppContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator creates app token for user :impersonatedUser with expiration time :expiration using the auth-app API
|
||||
*
|
||||
* @param string $impersonatedUser
|
||||
* @param string $expiration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator creates app token for user :impersonatedUser with expiration time :expiration using the auth-app API')]
|
||||
public function theAdministratorCreatesAppTokenForUserWithExpirationTimeViaAuthAppApi(
|
||||
string $impersonatedUser,
|
||||
string $expiration,
|
||||
|
||||
@@ -27,6 +27,7 @@ use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use TestHelpers\TokenHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use Behat\Step\When;
|
||||
|
||||
/**
|
||||
* Authentication functions
|
||||
@@ -135,19 +136,18 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When a user requests :url with :method and no authentication
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('a user requests :url with :method and no authentication')]
|
||||
public function userRequestsURLWithNoAuth(string $url, string $method): void {
|
||||
$this->featureContext->setResponse($this->sendRequest($url, $method));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When a user requests these endpoints with :method with body :body and no authentication about user :user
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $body
|
||||
@@ -157,6 +157,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('a user requests these endpoints with :method with body :body and no authentication about user :user')]
|
||||
public function userRequestsEndpointsWithBodyAndNoAuthThenStatusCodeAboutUser(
|
||||
string $method,
|
||||
string $body,
|
||||
@@ -177,7 +178,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When a user requests these endpoints with :method with no authentication about user :user
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $ofUser
|
||||
@@ -186,6 +186,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('a user requests these endpoints with :method with no authentication about user :user')]
|
||||
public function userRequestsEndpointsWithoutBodyAndNoAuthAboutUser(
|
||||
string $method,
|
||||
string $ofUser,
|
||||
@@ -205,7 +206,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When a user requests these endpoints with :method and no authentication
|
||||
*
|
||||
* @param string $method
|
||||
* @param TableNode $table
|
||||
@@ -213,6 +213,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('a user requests these endpoints with :method and no authentication')]
|
||||
public function userRequestsEndpointsWithNoAuthentication(string $method, TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
foreach ($table->getHash() as $row) {
|
||||
@@ -227,7 +228,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When a user requests these URLs with :method and no authentication
|
||||
*
|
||||
* @param $method
|
||||
* @param TableNode $table
|
||||
@@ -235,6 +235,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('a user requests these URLs with :method and no authentication')]
|
||||
public function aUserRequestsTheseUrlsWithAndNoAuthentication($method, TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['service']);
|
||||
foreach ($table->getHash() as $row) {
|
||||
@@ -250,7 +251,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the user :user requests these endpoints with :method with basic auth
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
@@ -259,6 +259,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('the user :user requests these endpoints with :method with basic auth')]
|
||||
public function userRequestsEndpointsWithBasicAuth(string $user, string $method, TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
foreach ($table->getHash() as $row) {
|
||||
@@ -269,7 +270,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" requests these endpoints with "([^"]*)" to (?:get|set) property "([^"]*)" about user "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
@@ -280,6 +280,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" requests these endpoints with "([^"]*)" to (?:get|set) property "([^"]*)" about user "([^"]*)"$/')]
|
||||
public function theUserRequestsTheseEndpointsToGetOrSetPropertyAboutUser(
|
||||
string $user,
|
||||
string $method,
|
||||
@@ -301,7 +302,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator requests these endpoints with :method
|
||||
*
|
||||
* @param string $method
|
||||
* @param TableNode $table
|
||||
@@ -309,6 +309,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('the administrator requests these endpoints with :method')]
|
||||
public function theAdminRequestsTheseEndpointsWithMethod(string $method, TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
foreach ($table->getHash() as $row) {
|
||||
@@ -323,7 +324,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests :url with :method using basic auth
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $url
|
||||
@@ -331,6 +331,7 @@ class AuthContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user requests :url with :method using basic auth')]
|
||||
public function userRequestsURLUsingBasicAuth(
|
||||
string $user,
|
||||
string $url,
|
||||
@@ -341,7 +342,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests :url with :method using basic auth and with headers
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $url
|
||||
@@ -351,6 +351,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user requests :url with :method using basic auth and with headers')]
|
||||
public function userRequestsURLWithUsingBasicAuthAndDepthHeader(
|
||||
string $user,
|
||||
string $url,
|
||||
@@ -382,7 +383,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests these endpoints with :method using password :password
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
@@ -392,6 +392,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user requests these endpoints with :method using password :password')]
|
||||
public function userRequestsTheseEndpointsWithPassword(
|
||||
string $user,
|
||||
string $method,
|
||||
@@ -411,7 +412,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests these endpoints with :method using password :password about user :ofUser
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
@@ -422,6 +422,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user requests these endpoints with :method using password :password about user :ofUser')]
|
||||
public function userRequestsTheseEndpointsUsingPasswordAboutUser(
|
||||
string $user,
|
||||
string $method,
|
||||
@@ -460,7 +461,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests these endpoints with :method including body :body using password :password about user :ofUser
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
@@ -472,6 +472,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user requests these endpoints with :method including body :body using password :password about user :ofUser')]
|
||||
public function userRequestsTheseEndpointsWithBodyUsingPasswordAboutUser(
|
||||
string $user,
|
||||
string $method,
|
||||
@@ -511,7 +512,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests these endpoints with :method including body :body about user :ofUser
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
@@ -522,6 +522,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user requests these endpoints with :method including body :body about user :ofUser')]
|
||||
public function userRequestsTheseEndpointsIncludingBodyAboutUser(
|
||||
string $user,
|
||||
string $method,
|
||||
@@ -556,7 +557,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :asUser requests these endpoints with :method using the password of user :ofUser
|
||||
*
|
||||
* @param string $asUser
|
||||
* @param string $method
|
||||
@@ -566,6 +566,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :asUser requests these endpoints with :method using the password of user :ofUser')]
|
||||
public function userRequestsTheseEndpointsWithoutBodyUsingThePasswordOfUser(
|
||||
string $asUser,
|
||||
string $method,
|
||||
@@ -596,7 +597,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :asUser requests these endpoints with :method including body :body using the password of user :user
|
||||
*
|
||||
* @param string $asUser
|
||||
* @param string $method
|
||||
@@ -607,6 +607,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('user :asUser requests these endpoints with :method including body :body using the password of user :user')]
|
||||
public function userRequestsTheseEndpointsIncludingBodyUsingPasswordOfUser(
|
||||
string $asUser,
|
||||
string $method,
|
||||
@@ -638,7 +639,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests these endpoints with :method about user :ofUser
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
@@ -648,6 +648,7 @@ class AuthContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user requests these endpoints with :method about user :ofUser')]
|
||||
public function userRequestsTheseEndpointsAboutUser(
|
||||
string $user,
|
||||
string $method,
|
||||
@@ -683,7 +684,6 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests :endpoint with :method without retrying
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $endpoint
|
||||
@@ -691,6 +691,7 @@ class AuthContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user requests :endpoint with :method without retrying')]
|
||||
public function userRequestsURLWithoutRetry(
|
||||
string $user,
|
||||
string $endpoint,
|
||||
@@ -717,13 +718,13 @@ class AuthContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user should not be able to log in with wrong password :password
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user should not be able to log in with wrong password :password')]
|
||||
public function userShouldNotBeAbleToLogInWithWrongPassword(
|
||||
string $user,
|
||||
string $password
|
||||
|
||||
@@ -28,6 +28,8 @@ use PHPUnit\Framework\Assert;
|
||||
use TestHelpers\OcsApiHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -133,7 +135,6 @@ class CapabilitiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :username retrieves the capabilities using the capabilities API
|
||||
*
|
||||
* @param string $username
|
||||
*
|
||||
@@ -141,27 +142,28 @@ class CapabilitiesContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('user :username retrieves the capabilities using the capabilities API')]
|
||||
public function userRetrievesCapabilities(string $username): void {
|
||||
$user = $this->featureContext->getActualUsername($username);
|
||||
$this->featureContext->setResponse($this->userGetsCapabilities($user, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator retrieves the capabilities using the capabilities API
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator retrieves the capabilities using the capabilities API')]
|
||||
public function theAdministratorGetsCapabilities(): void {
|
||||
$user = $this->getAdminUsernameForCapabilitiesCheck();
|
||||
$this->featureContext->setResponse($this->userGetsCapabilities($user, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the major-minor-micro version data in the response should match the version string
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the major-minor-micro version data in the response should match the version string')]
|
||||
public function checkVersionMajorMinorMicroResponse(): void {
|
||||
$jsonResponse = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||
$versionData = $jsonResponse->ocs->data->version;
|
||||
@@ -199,13 +201,13 @@ class CapabilitiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the status.php response should include
|
||||
*
|
||||
* @param PyStringNode $jsonExpected
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the status.php response should include')]
|
||||
public function statusPhpRespondedShouldMatch(PyStringNode $jsonExpected): void {
|
||||
$jsonExpectedDecoded = \json_decode($jsonExpected->getRaw(), true);
|
||||
$jsonRespondedDecoded = $this->featureContext->getJsonDecodedResponse();
|
||||
|
||||
@@ -26,6 +26,9 @@ use Psr\Http\Message\ResponseInterface;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use TestHelpers\UploadHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -62,7 +65,6 @@ class ChecksumContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user uploads file :source to :destination with checksum :checksum using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $source
|
||||
@@ -71,6 +73,7 @@ class ChecksumContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user uploads file :source to :destination with checksum :checksum using the WebDAV API')]
|
||||
public function userUploadsFileToWithChecksumUsingTheAPI(
|
||||
string $user,
|
||||
string $source,
|
||||
@@ -83,7 +86,6 @@ class ChecksumContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has uploaded file :source to :destination with checksum :checksum
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $source
|
||||
@@ -92,6 +94,7 @@ class ChecksumContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has uploaded file :source to :destination with checksum :checksum')]
|
||||
public function userHasUploadedFileToWithChecksumUsingTheAPI(
|
||||
string $user,
|
||||
string $source,
|
||||
@@ -132,7 +135,6 @@ class ChecksumContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has uploaded file with content :content and checksum :checksum to :destination
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $content
|
||||
@@ -141,6 +143,7 @@ class ChecksumContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has uploaded file with content :content and checksum :checksum to :destination')]
|
||||
public function userHasUploadedFileWithContentAndChecksumToUsingTheAPI(
|
||||
string $user,
|
||||
string $content,
|
||||
@@ -153,13 +156,13 @@ class ChecksumContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests the checksum of :path via propfind
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user requests the checksum of :path via propfind')]
|
||||
public function userRequestsTheChecksumOfViaPropfind(string $user, string $path): void {
|
||||
$this->featureContext->setResponse($this->propfindResourceChecksum($user, $path));
|
||||
}
|
||||
@@ -195,20 +198,19 @@ class ChecksumContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the webdav checksum should match :expectedChecksum
|
||||
*
|
||||
* @param string $expectedChecksum
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the webdav checksum should match :expectedChecksum')]
|
||||
public function theWebdavChecksumShouldMatch(string $expectedChecksum): void {
|
||||
$bodyContents = $this->featureContext->getResponse()->getBody()->getContents();
|
||||
$this->validateChecksum($bodyContents, $expectedChecksum);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then as user :user the webdav checksum of :path via propfind should match :expectedChecksum
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -217,6 +219,7 @@ class ChecksumContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('as user :user the webdav checksum of :path via propfind should match :expectedChecksum')]
|
||||
public function asUserTheWebdavChecksumOfPathViaPropfindShouldMatch(
|
||||
string $user,
|
||||
string $path,
|
||||
@@ -321,13 +324,13 @@ class ChecksumContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the header checksum should match :expectedChecksum
|
||||
*
|
||||
* @param string $expectedChecksum
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the header checksum should match :expectedChecksum')]
|
||||
public function theHeaderChecksumShouldMatch(string $expectedChecksum): void {
|
||||
$headerChecksums
|
||||
= $this->featureContext->getResponse()->getHeader('OC-Checksum');
|
||||
@@ -359,7 +362,6 @@ class ChecksumContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the header checksum when user :arg1 downloads file :arg2 using the WebDAV API should match :arg3
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileName
|
||||
@@ -368,6 +370,7 @@ class ChecksumContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the header checksum when user :arg1 downloads file :arg2 using the WebDAV API should match :arg3')]
|
||||
public function theHeaderChecksumWhenUserDownloadsFileUsingTheWebdavApiShouldMatch(
|
||||
string $user,
|
||||
string $fileName,
|
||||
@@ -433,7 +436,6 @@ class ChecksumContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user uploads chunk file :num of :total with :data to :destination with checksum :expectedChecksum using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param int $num
|
||||
@@ -444,6 +446,7 @@ class ChecksumContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user uploads chunk file :num of :total with :data to :destination with checksum :expectedChecksum using the WebDAV API')]
|
||||
public function userUploadsChunkFileOfWithToWithChecksum(
|
||||
string $user,
|
||||
int $num,
|
||||
@@ -464,7 +467,6 @@ class ChecksumContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has uploaded chunk file :num of :total with :data to :destination with checksum :expectedChecksum
|
||||
*
|
||||
* @param string $user
|
||||
* @param int $num
|
||||
@@ -475,6 +477,7 @@ class ChecksumContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has uploaded chunk file :num of :total with :data to :destination with checksum :expectedChecksum')]
|
||||
public function userHasUploadedChunkFileOfWithToWithChecksum(
|
||||
string $user,
|
||||
int $num,
|
||||
|
||||
@@ -26,6 +26,9 @@ use TestHelpers\CliHelper;
|
||||
use TestHelpers\OcConfigHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
/**
|
||||
* CLI context
|
||||
@@ -120,27 +123,26 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the administrator has stopped the server
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('the administrator has stopped the server')]
|
||||
public function theAdministratorHasStoppedTheServer(): void {
|
||||
$response = OcConfigHelper::stopOpencloud();
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the administrator (?:starts|has started) the server$/
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('/^the administrator (?:starts|has started) the server$/')]
|
||||
public function theAdministratorHasStartedTheServer(): void {
|
||||
$response = OcConfigHelper::startOpencloud();
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the administrator resets the password of (non-existing|existing) user "([^"]*)" to "([^"]*)" using the CLI$/
|
||||
*
|
||||
* @param string $status
|
||||
* @param string $user
|
||||
@@ -148,6 +150,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^the administrator resets the password of (non-existing|existing) user "([^"]*)" to "([^"]*)" using the CLI$/')]
|
||||
public function theAdministratorResetsThePasswordOfUserUsingTheCLI(
|
||||
string $status,
|
||||
string $user,
|
||||
@@ -167,10 +170,10 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator deletes the empty trashbin folders using the CLI
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator deletes the empty trashbin folders using the CLI')]
|
||||
public function theAdministratorDeletesEmptyTrashbinFoldersUsingTheCli(): void {
|
||||
$path = $this->featureContext->getStorageUsersRoot();
|
||||
$command = "trash purge-empty-dirs -p $path --dry-run=false";
|
||||
@@ -181,10 +184,10 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator checks the backup consistency using the CLI
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator checks the backup consistency using the CLI')]
|
||||
public function theAdministratorChecksTheBackupConsistencyUsingTheCli(): void {
|
||||
$path = $this->featureContext->getStorageUsersRoot();
|
||||
$command = "backup consistency -p $path";
|
||||
@@ -195,13 +198,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator creates app token for user :user with expiration time :expirationTime using the auth-app CLI
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $expirationTime
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator creates app token for user :user with expiration time :expirationTime using the auth-app CLI')]
|
||||
public function theAdministratorCreatesAppTokenForUserWithExpirationTimeUsingTheAuthAppCLI(
|
||||
string $user,
|
||||
string $expirationTime
|
||||
@@ -215,13 +218,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has created app token with expiration time :expirationTime using the auth-app CLI
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $expirationTime
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has created app token with expiration time :expirationTime using the auth-app CLI')]
|
||||
public function userHasCreatedAppTokenWithExpirationTimeUsingTheAuthAppCLI(
|
||||
string $user,
|
||||
string $expirationTime
|
||||
@@ -244,10 +247,10 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator removes all the file versions using the CLI
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator removes all the file versions using the CLI')]
|
||||
public function theAdministratorRemovesAllVersionsOfResources() {
|
||||
$path = $this->featureContext->getStorageUsersRoot();
|
||||
$command = "revisions purge -p $path --dry-run=false";
|
||||
@@ -258,7 +261,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator removes the versions of file :file of user :user from space :space using the CLI
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $user
|
||||
@@ -266,6 +268,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator removes the versions of file :file of user :user from space :space using the CLI')]
|
||||
public function theAdministratorRemovesTheVersionsOfFileUsingFileId($file, $user, $space) {
|
||||
$path = $this->featureContext->getStorageUsersRoot();
|
||||
$fileId = $this->spacesContext->getFileId($user, $space, $file);
|
||||
@@ -277,10 +280,10 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the administrator reindexes all spaces using the CLI$/
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator reindexes all spaces using the CLI')]
|
||||
public function theAdministratorReindexesAllSpacesUsingTheCli(): void {
|
||||
$endpoint = $this->featureContext->getBaseUrlHostName();
|
||||
$command = "search index --all-spaces --endpoint $endpoint:9220 --insecure";
|
||||
@@ -291,12 +294,12 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the administrator reindexes a space "([^"]*)" using the CLI$/
|
||||
*
|
||||
* @param string $spaceName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator reindexes a space :spaceName using the CLI')]
|
||||
public function theAdministratorReindexesASpaceUsingTheCli(string $spaceName): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getAdminUsername(), $spaceName);
|
||||
$endpoint = $this->featureContext->getBaseUrlHostName();
|
||||
@@ -308,12 +311,12 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator removes the file versions of space :space using the CLI
|
||||
*
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator removes the file versions of space :space using the CLI')]
|
||||
public function theAdministratorRemovesTheVersionsOfFilesInSpaceUsingSpaceId(string $space): void {
|
||||
$path = $this->featureContext->getStorageUsersRoot();
|
||||
$adminUsername = $this->featureContext->getAdminUsername();
|
||||
@@ -326,10 +329,10 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator purges the expired trash-bin items using the CLI
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator purges the expired trash-bin items using the CLI')]
|
||||
public function theAdministratorPurgesExpiredTrashBinItemsUsingTheCli(): void {
|
||||
$command = "storage-users trash-bin purge-expired";
|
||||
$body = [
|
||||
@@ -340,12 +343,12 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator lists the trash-bin items of space :space using the CLI
|
||||
*
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator lists the trash-bin items of space :space using the CLI')]
|
||||
public function theAdministratorListsTrashBinItemsOfSpaceUsingTheCli(string $space): void {
|
||||
$adminUsername = $this->featureContext->getAdminUsername();
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($adminUsername, $space);
|
||||
@@ -357,12 +360,12 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator lists the trash-bin items of the personal space of user :user using the CLI
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator lists the trash-bin items of the personal space of user :user using the CLI')]
|
||||
public function theAdministratorListsTrashBinItemsOfPersonalSpaceUsingTheCli(string $user): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, 'Personal');
|
||||
$command = "storage-users trash-bin list $spaceId";
|
||||
@@ -373,12 +376,12 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator restores all the trash-bin items of space :space using the CLI
|
||||
*
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator restores all the trash-bin items of space :space using the CLI')]
|
||||
public function theAdministratorRestoresAllTrashBinItemsOfSpaceUsingTheCli(string $space): void {
|
||||
$adminUsername = $this->featureContext->getAdminUsername();
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($adminUsername, $space);
|
||||
@@ -390,12 +393,12 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator restores all the trash-bin items of the personal space of user :user using the CLI
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator restores all the trash-bin items of the personal space of user :user using the CLI')]
|
||||
public function theAdministratorRestoresAllTrashBinItemsOfPersonalSpaceUsingTheCli(string $user): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, 'Personal');
|
||||
$command = "storage-users trash-bin restore-all $spaceId --yes";
|
||||
@@ -406,13 +409,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator restores the trash-bin item with file-id :fileId of space :space using the CLI
|
||||
*
|
||||
* @param string $fileId
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator restores the trash-bin item with file-id :fileId of space :space using the CLI')]
|
||||
public function theAdministratorRestoresTrashBinItemOfSpaceUsingTheCli(string $fileId, string $space): void {
|
||||
$adminUsername = $this->featureContext->getAdminUsername();
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($adminUsername, $space);
|
||||
@@ -424,13 +427,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator restores the trash-bin item with file-id :fileId of the personal space of user :user using the CLI
|
||||
*
|
||||
* @param string $fileId
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator restores the trash-bin item with file-id :fileId of the personal space of user :user using the CLI')]
|
||||
public function theAdministratorRestoresTrashBinItemOfPersonalSpaceUsingTheCli(string $fileId, string $user): void {
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, 'Personal');
|
||||
$command = "storage-users trash-bin restore $spaceId $fileId";
|
||||
@@ -441,10 +444,10 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator cleans up orphaned shares using the CLI
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator cleans up orphaned shares using the CLI')]
|
||||
public function theAdministratorCleansUpOrphanedSharesUsingTheCli(): void {
|
||||
$serviceAccountId = getenv('OC_SERVICE_ACCOUNT_ID') ?: 'service-account-id';
|
||||
$serviceAccountSecret = getenv('OC_SERVICE_ACCOUNT_SECRET') ?: 'service-account-secret';
|
||||
@@ -457,10 +460,10 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator lists the unified roles using the CLI
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator lists the unified roles using the CLI')]
|
||||
public function theAdministratorListsTheUnifiedRolesUsingTheCli(): void {
|
||||
$command = "graph list-unified-roles";
|
||||
$body = [
|
||||
@@ -470,10 +473,10 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the command should be successful
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the command should be successful')]
|
||||
public function theCommandShouldBeSuccessful(): void {
|
||||
$response = $this->featureContext->getResponse();
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
@@ -490,13 +493,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the command output (should|should not) contain "([^"]*)"$/
|
||||
*
|
||||
* @param string $shouldOrNot
|
||||
* @param string $output
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('/^the command output (should|should not) contain "([^"]*)"$/')]
|
||||
public function theCommandOutputShouldContain(string $shouldOrNot, string $output): void {
|
||||
$response = $this->featureContext->getResponse();
|
||||
$jsonResponse = $this->featureContext->getJsonDecodedResponse($response);
|
||||
@@ -510,13 +513,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator lists all the upload sessions
|
||||
* @When the administrator lists all the upload sessions with flag :flag
|
||||
*
|
||||
* @param string|null $flag
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator lists all the upload sessions')]
|
||||
#[When('the administrator lists all the upload sessions with flag :flag')]
|
||||
public function theAdministratorListsAllTheUploadSessions(?string $flag = null): void {
|
||||
if ($flag) {
|
||||
$flag = "--$flag";
|
||||
@@ -529,12 +532,12 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator cleans upload sessions with the following flags:
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator cleans upload sessions with the following flags:')]
|
||||
public function theAdministratorCleansUploadSessionsWithTheFollowingFlags(TableNode $table): void {
|
||||
$flag = "";
|
||||
foreach ($table->getRows() as $row) {
|
||||
@@ -549,10 +552,10 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator restarts the upload sessions that are in postprocessing
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator restarts the upload sessions that are in postprocessing')]
|
||||
public function theAdministratorRestartsTheUploadSessionsThatAreInPostprocessing(): void {
|
||||
$command = "storage-users uploads sessions --processing --restart --json";
|
||||
$body = [
|
||||
@@ -562,13 +565,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator restarts the upload sessions of file :file
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @return void
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('the administrator restarts the upload sessions of file :file')]
|
||||
public function theAdministratorRestartsUploadSessionsOfFile(string $file): void {
|
||||
$response = CliHelper::runCommand(["command" => "storage-users uploads sessions --json"]);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
@@ -588,7 +591,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the CLI response (should|should not) contain these entries:$/
|
||||
*
|
||||
* @param string $shouldOrNot
|
||||
* @param TableNode $table
|
||||
@@ -596,6 +598,7 @@ class CliContext implements Context {
|
||||
* @return void
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[Then('/^the CLI response (should|should not) contain these entries:$/')]
|
||||
public function theCLIResponseShouldContainTheseEntries(string $shouldOrNot, TableNode $table): void {
|
||||
$expectedFiles = $table->getColumn(0);
|
||||
$responseArray = $this->getJSONDecodedCliMessage($this->featureContext->getResponse());
|
||||
@@ -655,13 +658,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator creates the folder :folder for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $folder
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator creates the folder :folder for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorCreatesFolder(string $folder, string $user): void {
|
||||
$userUuid = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$storagePath = $this->getUsersStoragePath();
|
||||
@@ -677,12 +680,12 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator lists the content of the POSIX storage folder of user :user
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator lists the content of the POSIX storage folder of user :user')]
|
||||
public function theAdministratorCheckUsersFolder(string $user): void {
|
||||
$userUuid = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$storagePath = $this->getUsersStoragePath();
|
||||
@@ -694,7 +697,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator creates the file :file with content :content for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $content
|
||||
@@ -702,6 +704,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator creates the file :file with content :content for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorCreatesFile(string $file, string $content, string $user): void {
|
||||
$userUuid = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$storagePath = $this->getUsersStoragePath();
|
||||
@@ -717,7 +720,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator has created the file :file with content :content for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $content
|
||||
@@ -725,13 +727,13 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator has created the file :file with content :content for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorHasCreatedFile(string $file, string $content, string $user): void {
|
||||
$this->theAdministratorCreatesFile($file, $content, $user);
|
||||
$this->theCommandShouldBeSuccessful();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator creates the file :file with size :size for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $size Example: "1gb", "5gb"
|
||||
@@ -739,6 +741,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator creates the file :file with size :size for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorCreatesLargeFileWithSize(string $file, string $size, string $user): void {
|
||||
$userUuid = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$storagePath = $this->getUsersStoragePath();
|
||||
@@ -762,7 +765,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator creates :count files sequentially in the directory :dir for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param int $count
|
||||
* @param string $dir
|
||||
@@ -770,6 +772,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator creates :count files sequentially in the directory :dir for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorCreatesFilesSequentially(int $count, string $dir, string $user): void {
|
||||
$userUuid = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$storagePath = $this->getUsersStoragePath() . "/$userUuid/$dir";
|
||||
@@ -787,7 +790,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator creates :count files in parallel in the directory :dir for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param int $count
|
||||
* @param string $dir
|
||||
@@ -795,6 +797,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator creates :count files in parallel in the directory :dir for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorCreatesFilesInParallel(int $count, string $dir, string $user): void {
|
||||
$userUuid = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$storagePath = $this->getUsersStoragePath() . "/$userUuid/$dir";
|
||||
@@ -813,7 +816,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator puts the content :content into the file :file in the POSIX storage folder of user :user
|
||||
*
|
||||
* @param string $content
|
||||
* @param string $file
|
||||
@@ -821,6 +823,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator puts the content :content into the file :file in the POSIX storage folder of user :user')]
|
||||
public function theAdministratorChangesFileContent(string $content, string $file, string $user): void {
|
||||
// this downloads the file using WebDAV and by that checks if it's still in
|
||||
// postprocessing. So its effectively a check for finished postprocessing
|
||||
@@ -838,13 +841,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator reads the content of the file :file in the POSIX storage folder of user :user
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator reads the content of the file :file in the POSIX storage folder of user :user')]
|
||||
public function theAdministratorReadsTheFileContent(string $user, string $file): void {
|
||||
// this downloads the file using WebDAV and by that checks if it's still in
|
||||
// postprocessing. So its effectively a check for finished postprocessing
|
||||
@@ -860,7 +863,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator copies the file :file to the folder :folder for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -868,6 +870,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator copies the file :file to the folder :folder for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorCopiesFileToFolder(string $user, string $file, string $folder): void {
|
||||
// this downloads the file using WebDAV and by that checks if it's still in
|
||||
// postprocessing. So its effectively a check for finished postprocessing
|
||||
@@ -888,7 +891,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator renames the file :file to :newName for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -896,6 +898,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator renames the file :file to :newName for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorRenamesFile(string $user, string $file, string $newName): void {
|
||||
// this downloads the file using WebDAV and by that checks if it's still in
|
||||
// postprocessing. So its effectively a check for finished postprocessing
|
||||
@@ -916,7 +919,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator moves the file :file to the folder :folder for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -924,6 +926,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator moves the file :file to the folder :folder for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorMovesFileToFolder(string $user, string $file, string $folder): void {
|
||||
// this downloads the file using WebDAV and by that checks if it's still in
|
||||
// postprocessing. So its effectively a check for finished postprocessing
|
||||
@@ -944,13 +947,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator deletes the file :file for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator deletes the file :file for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorDeletesFile(string $file, string $user): void {
|
||||
$userUuid = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$storagePath = $this->getUsersStoragePath();
|
||||
@@ -964,13 +967,13 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator deletes the folder :folder for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $folder
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator deletes the folder :folder for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorDeletesFolder(string $folder, string $user): void {
|
||||
$userUuid = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$storagePath = $this->getUsersStoragePath();
|
||||
@@ -984,7 +987,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator copies the file :file to the space :space for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -992,6 +994,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator copies the file :file to the space :space for user :user on the POSIX filesystem')]
|
||||
public function theAdministratorCopiesFileToSpace(string $user, string $file, string $space): void {
|
||||
// this downloads the file using WebDAV and by that checks if it's still in
|
||||
// postprocessing. So its effectively a check for finished postprocessing
|
||||
@@ -1015,12 +1018,12 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator deletes the project space :space on the POSIX filesystem
|
||||
*
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator deletes the project space :space on the POSIX filesystem')]
|
||||
public function theAdministratorDeletesSpace(string $space): void {
|
||||
$projectsStoragePath = $this->getProjectsStoragePath();
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getAdminUsername(), $space);
|
||||
@@ -1035,7 +1038,6 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator checks the attribute :attribute of file :file for user :user on the POSIX filesystem
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param string $file
|
||||
@@ -1043,6 +1045,7 @@ class CliContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator checks the attribute :attribute of file :file for user :user on the POSIX filesystem')]
|
||||
public function theAdminChecksTheAttributeOfFileForUser(string $attribute, string $file, string $user): void {
|
||||
// this downloads the file using WebDAV and by that checks if it's still in
|
||||
// postprocessing. So its effectively a check for finished postprocessing
|
||||
|
||||
@@ -27,6 +27,9 @@ use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\CollaborationHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
/**
|
||||
* steps needed to re-configure OpenCloud server
|
||||
@@ -71,8 +74,6 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user checks the information of file :file of space :space using office :app
|
||||
* @When user :user checks the information of file :file of space :space using office :app with view mode :view
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -84,6 +85,8 @@ class CollaborationContext implements Context {
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user checks the information of file :file of space :space using office :app')]
|
||||
#[When('user :user checks the information of file :file of space :space using office :app with view mode :view')]
|
||||
public function userChecksTheInformationOfFileOfSpaceUsingOffice(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -120,8 +123,6 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user creates a file :file inside folder :folder in space :space using wopi endpoint
|
||||
* @When user :user tries to create a file :file inside folder :folder in space :space using wopi endpoint
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -131,6 +132,8 @@ class CollaborationContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user creates a file :file inside folder :folder in space :space using wopi endpoint')]
|
||||
#[When('user :user tries to create a file :file inside folder :folder in space :space using wopi endpoint')]
|
||||
public function userCreatesFileInsideFolderInSpaceUsingWopiEndpoint(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -193,8 +196,6 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public creates a file :file inside the last shared public link folder with password :password using wopi endpoint
|
||||
* @When the public tries to create a file :file inside the last shared public link folder with password :password using wopi endpoint
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $password
|
||||
@@ -202,6 +203,8 @@ class CollaborationContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('the public creates a file :file inside the last shared public link folder with password :password using wopi endpoint')]
|
||||
#[When('the public tries to create a file :file inside the last shared public link folder with password :password using wopi endpoint')]
|
||||
public function thePublicCreatesAFileInsideTheLastSharedPublicLinkFolderWithPasswordUsingWopiEndpoint(
|
||||
string $file,
|
||||
string $password
|
||||
@@ -210,8 +213,6 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public creates a file :file inside folder :folder in the last shared public link space with password :password using wopi endpoint
|
||||
* @When the public tries to create a file :file inside folder :folder in the last shared public link space with password :password using wopi endpoint
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $folder
|
||||
@@ -220,6 +221,8 @@ class CollaborationContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('the public creates a file :file inside folder :folder in the last shared public link space with password :password using wopi endpoint')]
|
||||
#[When('the public tries to create a file :file inside folder :folder in the last shared public link space with password :password using wopi endpoint')]
|
||||
public function thePublicCreatesAFileInsideFolderInTheLastSharedPublicLinkSpaceWithPasswordUsingWopiEndpoint(
|
||||
string $file,
|
||||
string $folder,
|
||||
@@ -229,7 +232,6 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to check the information of file :file of space :space using office :app with invalid file-id
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -241,6 +243,7 @@ class CollaborationContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('user :user tries to check the information of file :file of space :space using office :app with invalid file-id')]
|
||||
public function userTriesToCheckTheInformationOfFileOfSpaceUsingOfficeWithInvalidFileId(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -276,7 +279,6 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to create a file :file inside deleted folder using wopi endpoint
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -284,6 +286,7 @@ class CollaborationContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user tries to create a file :file inside deleted folder using wopi endpoint')]
|
||||
public function userTriesToCreateAFileInsideDeletedFolderUsingWopiEndpoint(string $user, string $file): void {
|
||||
$parentContainerId = $this->featureContext->getStoredFileID();
|
||||
$this->featureContext->setResponse(
|
||||
@@ -299,7 +302,6 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has sent the following app-open request:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $properties
|
||||
@@ -307,6 +309,7 @@ class CollaborationContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has sent the following app-open request:')]
|
||||
public function userHasSentTheFollowingAppOpenRequest(string $user, TableNode $properties): void {
|
||||
$rows = $properties->getRowsHash();
|
||||
$appResponse = CollaborationHelper::sendPOSTRequestToAppOpen(
|
||||
@@ -322,14 +325,14 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to get the information of the last opened file using wopi endpoint
|
||||
* @When user :user gets the information of the last opened file using wopi endpoint
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user tries to get the information of the last opened file using wopi endpoint')]
|
||||
#[When('user :user gets the information of the last opened file using wopi endpoint')]
|
||||
public function userGetsTheInformationOfTheLastOpenedFileUsingWopiEndpoint(string $user): void {
|
||||
$response = json_decode($this->getLastAppOpenData());
|
||||
$accessToken = $response->form_parameters->access_token;
|
||||
@@ -348,7 +351,6 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the response (should|should not) contain the following MIME types:$/
|
||||
*
|
||||
* @param string $shouldOrNot
|
||||
* @param TableNode $table
|
||||
@@ -356,6 +358,7 @@ class CollaborationContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the response (should|should not) contain the following MIME types:$/')]
|
||||
public function theFollowingMimeTypesShouldExistForUser(string $shouldOrNot, TableNode $table): void {
|
||||
$rows = $table->getRows();
|
||||
$responseArray = $this->featureContext->getJsonDecodedResponse(
|
||||
@@ -380,13 +383,13 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the app list response should contain the following template information for office :app:
|
||||
*
|
||||
* @param string $app
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the app list response should contain the following template information for office :app:')]
|
||||
public function theAppListResponseShouldContainTheFollowingTemplateInformationForOffice(
|
||||
string $app,
|
||||
TableNode $table
|
||||
@@ -442,7 +445,6 @@ class CollaborationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user has created a file :file using wopi endpoint
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -450,6 +452,7 @@ class CollaborationContext implements Context {
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user has created a file :file using wopi endpoint')]
|
||||
public function userHasCreatedAFileInSpaceUsingWopiEndpoint(string $user, string $file): string {
|
||||
$parentContainerId = $this->featureContext->getFileIdForPath($user, "/");
|
||||
$response = CollaborationHelper::createFile(
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Then;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -31,7 +32,6 @@ class FavoritesContext implements Context {
|
||||
private WebDavPropertiesContext $webDavPropertiesContext;
|
||||
|
||||
/**
|
||||
* @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should be favorited$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -40,6 +40,7 @@ class FavoritesContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('/^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should be favorited$/')]
|
||||
public function asUserFileOrFolderShouldBeFavorited(
|
||||
string $user,
|
||||
string $path,
|
||||
@@ -58,13 +59,13 @@ class FavoritesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should not be favorited$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('/^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should not be favorited$/')]
|
||||
public function asUserFileShouldNotBeFavorited(string $user, string $path): void {
|
||||
$this->asUserFileOrFolderShouldBeFavorited($user, $path, 0);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,9 @@ use Swaggest\JsonSchema\Exception\NumericException;
|
||||
use Swaggest\JsonSchema\Exception\ObjectException;
|
||||
use Swaggest\JsonSchema\Exception\StringException;
|
||||
use Swaggest\JsonSchema\Exception\TypeException;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -949,21 +952,21 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given using SharingNG
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('using SharingNG')]
|
||||
public function usingSharingNG(): void {
|
||||
$this->useSharingNG = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^using OCS API version "([^"]*)"$/
|
||||
*
|
||||
* @param string $version
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('using OCS API version :version')]
|
||||
public function usingOcsApiVersion(string $version): void {
|
||||
$this->ocsApiVersion = (int)$version;
|
||||
}
|
||||
@@ -1019,12 +1022,12 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^using server "(LOCAL|REMOTE)"$/
|
||||
*
|
||||
* @param string|null $server
|
||||
*
|
||||
* @return string Previous used server
|
||||
*/
|
||||
#[Given('/^using server "(LOCAL|REMOTE)"$/')]
|
||||
public function usingServer(?string $server): string {
|
||||
$previousServer = $this->currentServer;
|
||||
if ($server === 'LOCAL') {
|
||||
@@ -1323,8 +1326,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to URL "([^"]*)"$/
|
||||
* @When /^user "([^"]*)" tries to send HTTP method "([^"]*)" to URL "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $verb
|
||||
@@ -1332,6 +1333,8 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user sends HTTP method :verb to URL :url')]
|
||||
#[When('user :user tries to send HTTP method :verb to URL :url')]
|
||||
public function userSendsHTTPMethodToUrl(string $user, string $verb, string $url): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$endpoint = $this->substituteInLineCodes($url, $user);
|
||||
@@ -1339,7 +1342,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public sends HTTP method :method to URL :url with password :password
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
@@ -1347,6 +1349,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public sends HTTP method :method to URL :url with password :password')]
|
||||
public function thePublicSendsHttpMethodToUrlWithPassword(string $method, string $url, string $password): void {
|
||||
$password = $this->getActualPassword($password);
|
||||
$token = $this->shareNgGetLastCreatedLinkShareToken();
|
||||
@@ -1367,7 +1370,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to URL "([^"]*)" with headers$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $verb
|
||||
@@ -1378,6 +1380,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('user :user sends HTTP method :verb to URL :url with headers')]
|
||||
public function userSendsHTTPMethodToUrlWithHeaders(
|
||||
string $user,
|
||||
string $verb,
|
||||
@@ -1419,7 +1422,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user sends HTTP method :method to URL :davPath with content :content
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
@@ -1428,6 +1430,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user sends HTTP method :method to URL :davPath with content :content')]
|
||||
public function userSendsHttpMethodToUrlWithContent(
|
||||
string $user,
|
||||
string $method,
|
||||
@@ -1438,7 +1441,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to URL "([^"]*)" with password "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $verb
|
||||
@@ -1447,6 +1449,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user sends HTTP method :verb to URL :url with password :password')]
|
||||
public function userSendsHTTPMethodToUrlWithPassword(
|
||||
string $user,
|
||||
string $verb,
|
||||
@@ -1618,7 +1621,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the ocs JSON data of the response should match
|
||||
*
|
||||
* @param PyStringNode $schemaString
|
||||
*
|
||||
@@ -1626,6 +1628,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the ocs JSON data of the response should match')]
|
||||
public function theOcsDataOfTheResponseShouldMatch(
|
||||
PyStringNode $schemaString
|
||||
): void {
|
||||
@@ -1637,13 +1640,13 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the JSON data of the response should match
|
||||
*
|
||||
* @param PyStringNode $schemaString
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the JSON data of the response should match')]
|
||||
public function theJsonDataOfTheResponseShouldMatch(PyStringNode $schemaString): void {
|
||||
$responseBody = $this->getJsonDecodedResponseBodyContent();
|
||||
$this->assertJsonDocumentMatchesSchema(
|
||||
@@ -1653,24 +1656,24 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the HTTP status code should be "([^"]*)"$/
|
||||
*
|
||||
* @param int|string $statusCode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the HTTP status code should be :statusCode')]
|
||||
public function thenTheHTTPStatusCodeShouldBe($statusCode): void {
|
||||
$this->theHTTPStatusCodeShouldBe($statusCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the HTTP status code should be "([^"]*)" or "([^"]*)"$/
|
||||
*
|
||||
* @param int|string $statusCode1
|
||||
* @param int|string $statusCode2
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the HTTP status code should be :statusCode1 or :statusCode2')]
|
||||
public function theHTTPStatusCodeShouldBeOr($statusCode1, $statusCode2): void {
|
||||
$this->theHTTPStatusCodeShouldBe(
|
||||
[$statusCode1, $statusCode2]
|
||||
@@ -1678,7 +1681,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the HTTP status code should be between "(\d+)" and "(\d+)"$/
|
||||
*
|
||||
* @param int|string $minStatusCode
|
||||
* @param int|string $maxStatusCode
|
||||
@@ -1686,6 +1688,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the HTTP status code should be between :minStatusCode and :maxStatusCode')]
|
||||
public function theHTTPStatusCodeShouldBeBetween(
|
||||
$minStatusCode,
|
||||
$maxStatusCode,
|
||||
@@ -2016,10 +2019,10 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator requests status.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator requests status.php')]
|
||||
public function theAdministratorRequestsStatusPhp(): void {
|
||||
$this->response = $this->getStatusPhp();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ use Psr\Http\Message\ResponseInterface;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -55,7 +58,6 @@ class FilesVersionsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to get versions of file :file from :fileOwner
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -64,12 +66,12 @@ class FilesVersionsContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user tries to get versions of file :file from :fileOwner')]
|
||||
public function userTriesToGetFileVersions(string $user, string $file, string $fileOwner): void {
|
||||
$this->featureContext->setResponse($this->getFileVersions($user, $file, $fileOwner));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets the number of versions of file :file
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -77,12 +79,12 @@ class FilesVersionsContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user gets the number of versions of file :file')]
|
||||
public function userGetsFileVersions(string $user, string $file): void {
|
||||
$this->featureContext->setResponse($this->getFileVersions($user, $file));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public tries to get the number of versions of file :file with password :password using file-id :endpoint
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $password
|
||||
@@ -90,6 +92,7 @@ class FilesVersionsContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public tries to get the number of versions of file :file with password :password using file-id :endpoint')]
|
||||
public function thePublicTriesToGetTheNumberOfVersionsOfFileWithPasswordUsingFileId(
|
||||
string $file,
|
||||
string $password,
|
||||
@@ -148,14 +151,14 @@ class FilesVersionsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets the number of versions of file :resource using file-id :fileId
|
||||
* @When user :user tries to get the number of versions of file :resource using file-id :fileId
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileId
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user gets the number of versions of file :resource using file-id :fileId')]
|
||||
#[When('user :user tries to get the number of versions of file :resource using file-id :fileId')]
|
||||
public function userGetsTheNumberOfVersionsOfFileOfTheSpace(string $user, string $fileId): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->featureContext->makeDavRequest(
|
||||
@@ -240,7 +243,6 @@ class FilesVersionsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has restored version index :versionIndex of file :path
|
||||
*
|
||||
* @param string $user
|
||||
* @param int $versionIndex
|
||||
@@ -249,13 +251,13 @@ class FilesVersionsContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has restored version index :versionIndex of file :path')]
|
||||
public function userHasRestoredVersionIndexOfFile(string $user, int $versionIndex, string $path): void {
|
||||
$response = $this->restoreVersionIndexOfFile($user, $versionIndex, $path);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user restores version index :versionIndex of file :path using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param int $versionIndex
|
||||
@@ -264,6 +266,7 @@ class FilesVersionsContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user restores version index :versionIndex of file :path using the WebDAV API')]
|
||||
public function userRestoresVersionIndexOfFile(string $user, int $versionIndex, string $path): void {
|
||||
$response = $this->restoreVersionIndexOfFile($user, $versionIndex, $path);
|
||||
$this->featureContext->setResponse($response, $user);
|
||||
@@ -297,7 +300,6 @@ class FilesVersionsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the version folder of file :path for user :user should contain :count element(s)
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $user
|
||||
@@ -306,6 +308,7 @@ class FilesVersionsContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the version folder of file :path for user :user should contain :count element(s)')]
|
||||
public function theVersionFolderOfFileShouldContainElements(
|
||||
string $path,
|
||||
string $user,
|
||||
@@ -322,7 +325,6 @@ class FilesVersionsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the content length of file :path with version index :index for user :user in versions folder should be :length
|
||||
*
|
||||
* @param string $path
|
||||
* @param int $index
|
||||
@@ -332,6 +334,7 @@ class FilesVersionsContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the content length of file :path with version index :index for user :user in versions folder should be :length')]
|
||||
public function theContentLengthOfFileForUserInVersionsFolderIs(
|
||||
string $path,
|
||||
int $index,
|
||||
@@ -406,7 +409,6 @@ class FilesVersionsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user downloads the version of file :path with the index :index
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -415,12 +417,12 @@ class FilesVersionsContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user downloads the version of file :path with the index :index')]
|
||||
public function userDownloadsVersion(string $user, string $path, string $index): void {
|
||||
$this->featureContext->setResponse($this->downloadVersion($user, $path, $index), $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the content of version index "([^"]*)" of file "([^"]*)" for user "([^"]*)" should be "([^"]*)"$/
|
||||
*
|
||||
* @param string $index
|
||||
* @param string $path
|
||||
@@ -430,6 +432,7 @@ class FilesVersionsContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the content of version index :index of file :path for user :user should be :content')]
|
||||
public function theContentOfVersionIndexOfFileForUserShouldBe(
|
||||
string $index,
|
||||
string $path,
|
||||
@@ -442,7 +445,6 @@ class FilesVersionsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" retrieves the meta information of (file|fileId) "([^"]*)" using the meta API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileOrFileId
|
||||
@@ -450,6 +452,7 @@ class FilesVersionsContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" retrieves the meta information of (file|fileId) "([^"]*)" using the meta API$/')]
|
||||
public function userGetMetaInfo(string $user, string $fileOrFileId, string $path): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
@@ -525,8 +528,6 @@ class FilesVersionsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets the number of versions of file :file from space :space
|
||||
* @When user :user tries to get the number of versions of file :file from space :space
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -534,6 +535,8 @@ class FilesVersionsContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user gets the number of versions of file :file from space :space')]
|
||||
#[When('user :user tries to get the number of versions of file :file from space :space')]
|
||||
public function userGetsTheNumberOfVersionsOfFileFromSpace(string $user, string $file, string $space): void {
|
||||
$fileId = $this->spacesContext->getFileId($user, $space, $file);
|
||||
$this->featureContext->setResponse(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,9 @@ use TestHelpers\OcsApiHelper;
|
||||
use TestHelpers\GraphHelper;
|
||||
use TestHelpers\SettingsHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -128,12 +131,12 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" lists all notifications$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user lists all notifications')]
|
||||
public function userListAllNotifications(string $user): void {
|
||||
$response = $this->listAllNotifications($user);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -160,7 +163,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user deletes all notifications
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -168,13 +170,13 @@ class NotificationContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('user :user deletes all notifications')]
|
||||
public function userDeletesAllNotifications(string $user): void {
|
||||
$response = $this->deleteAllNotifications($user);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has deleted all notifications
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -182,13 +184,13 @@ class NotificationContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[Given('user :user has deleted all notifications')]
|
||||
public function userHasDeletedAllNotifications(string $user): void {
|
||||
$response = $this->deleteAllNotifications($user);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user deletes a notification related to resource :resource with subject :subject
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
@@ -198,6 +200,7 @@ class NotificationContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('user :user deletes a notification related to resource :resource with subject :subject')]
|
||||
public function userDeletesNotificationOfResourceAndSubject(string $user, string $resource, string $subject): void {
|
||||
$response = $this->listAllNotifications($user);
|
||||
$this->filterNotificationsBySubjectAndResource($subject, $resource, $response);
|
||||
@@ -229,11 +232,11 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the notifications should be empty
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the notifications should be empty')]
|
||||
public function theNotificationsShouldBeEmpty(): void {
|
||||
$statusCode = $this->featureContext->getResponse()->getStatusCode();
|
||||
if ($statusCode !== 200) {
|
||||
@@ -248,13 +251,13 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should not have any notification
|
||||
*
|
||||
* @param $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :user should not have any notification')]
|
||||
public function userShouldNotHaveAnyNotification($user): void {
|
||||
$response = $this->listAllNotifications($user);
|
||||
$notifications = $this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data;
|
||||
@@ -262,13 +265,13 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^there should be "([^"]*)" notifications$/
|
||||
*
|
||||
* @param int $numberOfNotification
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('there should be :numberOfNotification notifications')]
|
||||
public function userShouldHaveNotifications(int $numberOfNotification): void {
|
||||
if (!isset($this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data)) {
|
||||
throw new Exception("Notification is empty");
|
||||
@@ -283,7 +286,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the JSON response should contain a notification message with the subject "([^"]*)" and the message-details should match$/
|
||||
*
|
||||
* @param string $subject
|
||||
* @param PyStringNode $schemaString
|
||||
@@ -291,6 +293,7 @@ class NotificationContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the JSON response should contain a notification message with the subject :subject and the message-details should match')]
|
||||
public function theJsonDataFromLastResponseShouldMatch(
|
||||
string $subject,
|
||||
PyStringNode $schemaString
|
||||
@@ -377,7 +380,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should get a notification with subject "([^"]*)" and message:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $subject
|
||||
@@ -386,6 +388,7 @@ class NotificationContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :user should get a notification with subject :subject and message:')]
|
||||
public function userShouldGetANotificationWithMessage(string $user, string $subject, TableNode $table): void {
|
||||
$count = 0;
|
||||
// Sometimes the test might try to get the notifications before the server has created the notification.
|
||||
@@ -419,7 +422,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should get a notification for resource :resource with subject :subject and message:
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
@@ -429,6 +431,7 @@ class NotificationContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :user should get a notification for resource :resource with subject :subject and message:')]
|
||||
public function userShouldGetNotificationForResourceWithMessage(
|
||||
string $user,
|
||||
string $resource,
|
||||
@@ -462,7 +465,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should not get a notification related to resource :resource with subject :subject
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
@@ -470,6 +472,7 @@ class NotificationContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('user :user should not get a notification related to resource :resource with subject :subject')]
|
||||
public function userShouldNotHaveANotificationRelatedToResourceWithSubject(
|
||||
string $user,
|
||||
string $resource,
|
||||
@@ -486,7 +489,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should have received the following email from user :sender about the share of project space :spaceName
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $sender
|
||||
@@ -496,6 +498,7 @@ class NotificationContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :user should have received the following email from user :sender about the share of project space :spaceName')]
|
||||
public function userShouldHaveReceivedTheFollowingEmailFromUserAboutTheShareOfProjectSpace(
|
||||
string $user,
|
||||
string $sender,
|
||||
@@ -529,7 +532,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should have received the following email from user :sender
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $sender
|
||||
@@ -538,6 +540,7 @@ class NotificationContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :user should have received the following email from user :sender')]
|
||||
public function userShouldHaveReceivedTheFollowingEmailFromUser(
|
||||
string $user,
|
||||
string $sender,
|
||||
@@ -552,7 +555,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should have received the following email from user :sender ignoring whitespaces
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $sender
|
||||
@@ -561,6 +563,7 @@ class NotificationContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :user should have received the following email from user :sender ignoring whitespaces')]
|
||||
public function userShouldHaveReceivedTheFollowingEmailFromUserIgnoringWhitespaces(
|
||||
string $user,
|
||||
string $sender,
|
||||
@@ -692,8 +695,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator creates a deprovisioning notification
|
||||
* @When user :user tries to create a deprovisioning notification
|
||||
*
|
||||
* @param string|null $user
|
||||
*
|
||||
@@ -702,6 +703,8 @@ class NotificationContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('the administrator creates a deprovisioning notification')]
|
||||
#[When('user :user tries to create a deprovisioning notification')]
|
||||
public function theAdministratorCreatesADeprovisioningNotification(?string $user = null) {
|
||||
$response = $this->userCreatesDeprovisioningNotification($user);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -709,7 +712,6 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator creates a deprovisioning notification for date :deprovision_date of format :deprovision_date_format
|
||||
*
|
||||
* @param $deprovision_date
|
||||
* @param $deprovision_date_format
|
||||
@@ -719,6 +721,7 @@ class NotificationContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('the administrator creates a deprovisioning notification for date :deprovision_date of format :deprovision_date_format')]
|
||||
public function theAdministratorCreatesADeprovisioningNotificationUsingDateFormat(
|
||||
$deprovision_date,
|
||||
$deprovision_date_format
|
||||
@@ -729,23 +732,23 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the administrator has created a deprovisioning notification
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('the administrator has created a deprovisioning notification')]
|
||||
public function userHasCreatedDeprovisioningNotification(): void {
|
||||
$response = $this->userCreatesDeprovisioningNotification();
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator deletes the deprovisioning notification
|
||||
* @When user :user tries to delete the deprovisioning notification
|
||||
*
|
||||
* @param string|null $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the administrator deletes the deprovisioning notification')]
|
||||
#[When('user :user tries to delete the deprovisioning notification')]
|
||||
public function userDeletesDeprovisioningNotification(?string $user = null): void {
|
||||
$payload["ids"] = ["deprovision"];
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\OcsApiHelper;
|
||||
use TestHelpers\TranslationHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -38,21 +40,19 @@ class OCSContext implements Context {
|
||||
private FeatureContext $featureContext;
|
||||
|
||||
/**
|
||||
* @When /^the user sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)"$/
|
||||
*
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the user sends HTTP method :verb to OCS API endpoint :url')]
|
||||
public function theUserSendsToOcsApiEndpoint(string $verb, string $url): void {
|
||||
$response = $this->theUserSendsToOcsApiEndpointWithBody($verb, $url);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)"$/
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" using password "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $verb
|
||||
@@ -61,6 +61,8 @@ class OCSContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user sends HTTP method :verb to OCS API endpoint :url')]
|
||||
#[When('user :user sends HTTP method :verb to OCS API endpoint :url using password :password')]
|
||||
public function userSendsToOcsApiEndpoint(string $user, string $verb, string $url, ?string $password = null): void {
|
||||
$response = $this->sendRequestToOcsEndpoint(
|
||||
$user,
|
||||
@@ -163,7 +165,6 @@ class OCSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with headers$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $verb
|
||||
@@ -173,6 +174,7 @@ class OCSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user sends HTTP method :verb to OCS API endpoint :url with headers')]
|
||||
public function userSendsToOcsApiEndpointWithHeaders(
|
||||
string $user,
|
||||
string $verb,
|
||||
@@ -194,7 +196,6 @@ class OCSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the OCS status code should be "([^"]*)"$/
|
||||
*
|
||||
* @param string $statusCode
|
||||
* @param string $message
|
||||
@@ -203,6 +204,7 @@ class OCSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the OCS status code should be :statusCode')]
|
||||
public function theOCSStatusCodeShouldBe(
|
||||
string $statusCode,
|
||||
string $message = "",
|
||||
@@ -238,7 +240,6 @@ class OCSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the OCS status code should be "([^"]*)" or "([^"]*)"$/
|
||||
*
|
||||
* @param string $statusCode1
|
||||
* @param string $statusCode2
|
||||
@@ -246,6 +247,7 @@ class OCSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the OCS status code should be :statusCode1 or :statusCode2')]
|
||||
public function theOcsStatusCodeShouldBeOr(string $statusCode1, string $statusCode2): void {
|
||||
$statusCodes = [$statusCode1,$statusCode1];
|
||||
$response = $this->featureContext->getResponse();
|
||||
@@ -264,14 +266,13 @@ class OCSContext implements Context {
|
||||
/**
|
||||
* Check the text in an OCS status message
|
||||
*
|
||||
* @Then /^the OCS status message should be "([^"]*)"$/
|
||||
* @Then /^the OCS status message should be "([^"]*)" in language "([^"]*)"$/
|
||||
*
|
||||
* @param string $statusMessage
|
||||
* @param string|null $language
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the OCS status message should be :statusMessage')]
|
||||
#[Then('the OCS status message should be :statusMessage in language :language')]
|
||||
public function theOCSStatusMessageShouldBe(string $statusMessage, ?string $language = null): void {
|
||||
$language = TranslationHelper::getLanguage($language);
|
||||
$statusMessage = $this->getActualStatusMessage($statusMessage, $language);
|
||||
@@ -299,12 +300,11 @@ class OCSContext implements Context {
|
||||
* File "abc.txt" can't be shared due to reason "xyz"
|
||||
* """
|
||||
*
|
||||
* @Then /^the OCS status message should be:$/
|
||||
*
|
||||
* @param PyStringNode $statusMessage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the OCS status message should be:')]
|
||||
public function theOCSStatusMessageShouldBePyString(
|
||||
PyStringNode $statusMessage
|
||||
): void {
|
||||
|
||||
@@ -24,6 +24,7 @@ use GuzzleHttp\Exception\GuzzleException;
|
||||
use TestHelpers\OcConfigHelper;
|
||||
use TestHelpers\GraphHelper;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use Behat\Step\Given;
|
||||
|
||||
/**
|
||||
* steps needed to re-configure OpenCloud server
|
||||
@@ -48,13 +49,13 @@ class OcConfigContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given async upload has been enabled with post-processing delayed to :delayTime seconds
|
||||
*
|
||||
* @param string $delayTime
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('async upload has been enabled with post-processing delayed to :delayTime seconds')]
|
||||
public function asyncUploadHasBeenEnabledWithDelayedPostProcessing(string $delayTime): void {
|
||||
$envs = [
|
||||
"OC_ASYNC_UPLOADS" => true,
|
||||
@@ -72,7 +73,6 @@ class OcConfigContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the config :configVariable has been set to :configValue
|
||||
*
|
||||
* @param string $configVariable
|
||||
* @param string $configValue
|
||||
@@ -80,6 +80,7 @@ class OcConfigContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('the config :configVariable has been set to :configValue')]
|
||||
public function theConfigHasBeenSetTo(string $configVariable, string $configValue): void {
|
||||
$envs = [
|
||||
$configVariable => $configValue,
|
||||
@@ -97,12 +98,12 @@ class OcConfigContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the administrator has enabled the permissions role :role
|
||||
*
|
||||
* @param string $role
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('the administrator has enabled the permissions role :role')]
|
||||
public function theAdministratorHasEnabledTheRole(string $role): void {
|
||||
$roleId = GraphHelper::getPermissionsRoleIdByName($role);
|
||||
$defaultRoles = array_values(GraphHelper::DEFAULT_PERMISSIONS_ROLES);
|
||||
@@ -123,12 +124,12 @@ class OcConfigContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the administrator has disabled the permissions role :role
|
||||
*
|
||||
* @param string $role
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('the administrator has disabled the permissions role :role')]
|
||||
public function theAdministratorHasDisabledThePermissionsRole(string $role): void {
|
||||
$roleId = GraphHelper::getPermissionsRoleIdByName($role);
|
||||
$availableRoles = $this->getEnabledPermissionsRoles();
|
||||
@@ -149,7 +150,6 @@ class OcConfigContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the config :configVariable has been set to path :path
|
||||
*
|
||||
* @param string $configVariable
|
||||
* @param string $path
|
||||
@@ -157,6 +157,7 @@ class OcConfigContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('the config :configVariable has been set to path :path')]
|
||||
public function theConfigHasBeenSetPathTo(string $configVariable, string $path): void {
|
||||
if (\getenv('TEST_ROOT_PATH')) {
|
||||
$path = \getenv('TEST_ROOT_PATH') . "/" . $path;
|
||||
@@ -177,13 +178,13 @@ class OcConfigContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the following configs have been set:
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('the following configs have been set:')]
|
||||
public function theConfigHasBeenSetToValue(TableNode $table): void {
|
||||
$envs = [];
|
||||
foreach ($table->getHash() as $row) {
|
||||
|
||||
@@ -27,6 +27,8 @@ use TestHelpers\OcHelper;
|
||||
use TestHelpers\OcmHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\When;
|
||||
|
||||
/**
|
||||
* Acceptance test steps related to testing federation share(ocm) features
|
||||
@@ -88,8 +90,6 @@ class OcmContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When :user creates the federation share invitation
|
||||
* @When :user creates the federation share invitation with email :email and description :description
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $email
|
||||
@@ -98,13 +98,13 @@ class OcmContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When(':user creates the federation share invitation')]
|
||||
#[When(':user creates the federation share invitation with email :email and description :description')]
|
||||
public function userCreatesTheFederationShareInvitation(string $user, $email = null, $description = null): void {
|
||||
$this->featureContext->setResponse($this->createInvitation($user, $email, $description));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given :user has created the federation share invitation
|
||||
* @Given :user has created the federation share invitation with email :email and description :description
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $email
|
||||
@@ -113,6 +113,8 @@ class OcmContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given(':user has created the federation share invitation')]
|
||||
#[Given(':user has created the federation share invitation with email :email and description :description')]
|
||||
public function userHasCreatedTheFederationShareInvitation(string $user, $email = null, $description = null): void {
|
||||
$response = $this->createInvitation($user, $email, $description);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
@@ -141,38 +143,38 @@ class OcmContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When :user accepts the last federation share invitation
|
||||
* @When :user tries to accept the last federation share invitation
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When(':user accepts the last federation share invitation')]
|
||||
#[When(':user tries to accept the last federation share invitation')]
|
||||
public function userAcceptsTheLastFederationShareInvitation(string $user): void {
|
||||
$this->featureContext->setResponse($this->acceptInvitation($user));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When :user tries to accept the invitation with invalid token
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When(':user tries to accept the invitation with invalid token')]
|
||||
public function userTriesToAcceptInvitationWithInvalidToken(string $user): void {
|
||||
$this->featureContext->setResponse($this->acceptInvitation($user, WebDavHelper::generateUUIDv4()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given :user has accepted invitation
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given(':user has accepted invitation')]
|
||||
public function userHasAcceptedTheLastFederationShareInvitation(string $user): void {
|
||||
$response = $this->acceptInvitation($user);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
@@ -194,13 +196,13 @@ class OcmContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When :user searches for accepted users
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When(':user searches for accepted users')]
|
||||
public function userFindsAcceptedUsers(string $user): void {
|
||||
$this->featureContext->setResponse($this->findAcceptedUsers($user));
|
||||
}
|
||||
@@ -239,31 +241,30 @@ class OcmContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When :user lists the created invitations
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When(':user lists the created invitations')]
|
||||
public function userListsCreatedInvitations(string $user): void {
|
||||
$this->featureContext->setResponse($this->listInvitations($user));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the user waits :number seconds for the invitation token to expire
|
||||
*
|
||||
* @param int $number
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('the user waits :number seconds for the invitation token to expire')]
|
||||
public function theUserWaitsForTokenToExpire(int $number): void {
|
||||
\sleep($number);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user deletes federated connection with user :ocmUser using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $ocmUser
|
||||
@@ -271,12 +272,12 @@ class OcmContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user deletes federated connection with user :ocmUser using the Graph API')]
|
||||
public function userDeletesFederatedConnectionWithUserUsingTheGraphApi(string $user, string $ocmUser): void {
|
||||
$this->featureContext->setResponse($this->deleteConnection($user, $ocmUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user has deleted federated connection with user :ocmUser
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $ocmUser
|
||||
@@ -284,6 +285,7 @@ class OcmContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user has deleted federated connection with user :ocmUser')]
|
||||
public function userHasDeletedFederatedConnectionWithUser(string $user, string $ocmUser): void {
|
||||
$response = $this->deleteConnection($user, $ocmUser);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
|
||||
@@ -32,6 +32,9 @@ use TestHelpers\GraphHelper;
|
||||
use Laminas\Ldap\Exception\LdapException;
|
||||
use Laminas\Ldap\Ldap;
|
||||
use TestHelpers\TokenHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
/**
|
||||
* Functions for provisioning of users and groups
|
||||
@@ -188,13 +191,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has been created with default attributes
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Given('user :user has been created with default attributes')]
|
||||
public function userHasBeenCreatedWithDefaultAttributes(
|
||||
string $user
|
||||
): void {
|
||||
@@ -202,13 +205,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given these users have been created without being initialized:
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Given('these users have been created without being initialized:')]
|
||||
public function userHasBeenCreatedWithDefaultAttributesAndNotInitialized(
|
||||
TableNode $table
|
||||
): void {
|
||||
@@ -216,7 +219,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given these users have been created with default attributes:
|
||||
* expects a table of users with the heading
|
||||
* "|username|"
|
||||
*
|
||||
@@ -225,12 +227,12 @@ trait Provisioning {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Given('these users have been created with default attributes:')]
|
||||
public function theseUsersHaveBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles(TableNode $table): void {
|
||||
$this->usersHaveBeenCreated($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the user :byUser has created a new user with the following attributes:
|
||||
*
|
||||
* @param string $byUser
|
||||
* @param TableNode $table
|
||||
@@ -238,6 +240,7 @@ trait Provisioning {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Given('the user :byUser has created a new user with the following attributes:')]
|
||||
public function theAdministratorHasCreatedANewUserWithFollowingSettings(string $byUser, TableNode $table): void {
|
||||
$rows = $table->getRowsHash();
|
||||
$this->userHasBeenCreated(
|
||||
@@ -725,13 +728,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the administrator deletes user "([^"]*)" using the provisioning API$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('the administrator deletes user :user using the provisioning API')]
|
||||
public function theAdminDeletesUserUsingTheProvisioningApi(string $user): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$this->setResponse($this->deleteUser($user));
|
||||
@@ -739,13 +742,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should exist$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[Then('user :user should exist')]
|
||||
public function userShouldExist(string $user): void {
|
||||
Assert::assertTrue(
|
||||
$this->userExists($user),
|
||||
@@ -754,13 +757,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should not exist$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[Then('user :user should not exist')]
|
||||
public function userShouldNotExist(string $user): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
Assert::assertFalse(
|
||||
@@ -771,7 +774,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^group "([^"]*)" should exist$/
|
||||
*
|
||||
* @param string $group
|
||||
*
|
||||
@@ -779,6 +781,7 @@ trait Provisioning {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Then('group :group should exist')]
|
||||
public function groupShouldExist(string $group): void {
|
||||
Assert::assertTrue(
|
||||
$this->groupExists($group),
|
||||
@@ -787,7 +790,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^group "([^"]*)" should not exist$/
|
||||
*
|
||||
* @param string $group
|
||||
*
|
||||
@@ -795,6 +797,7 @@ trait Provisioning {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Then('group :group should not exist')]
|
||||
public function groupShouldNotExist(string $group): void {
|
||||
Assert::assertFalse(
|
||||
$this->groupExists($group),
|
||||
@@ -803,7 +806,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^these groups should (not|)\s?exist:$/
|
||||
* expects a table of groups with the heading "groupname"
|
||||
*
|
||||
* @param string $shouldOrNot (not|)
|
||||
@@ -812,6 +814,7 @@ trait Provisioning {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^these groups should (not|)\\s?exist:$/')]
|
||||
public function theseGroupsShouldNotExist(string $shouldOrNot, TableNode $table): void {
|
||||
$should = ($shouldOrNot !== "not");
|
||||
$this->verifyTableNodeColumns($table, ['groupname']);
|
||||
@@ -832,13 +835,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has been deleted$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has been deleted')]
|
||||
public function userHasBeenDeleted(string $user): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
if ($this->isTestingWithLdap() && \in_array($user, $this->ldapCreatedUsers)) {
|
||||
@@ -886,13 +889,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets the list of all users using the provisioning API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user gets the list of all users using the provisioning API')]
|
||||
public function userGetsTheListOfAllUsersUsingTheProvisioningApi(string $user): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->userGetsTheListOfAllUsers($user)
|
||||
@@ -1121,7 +1124,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator removes user :user from group :group using the provisioning API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $group
|
||||
@@ -1129,6 +1131,7 @@ trait Provisioning {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('the administrator removes user :user from group :group using the provisioning API')]
|
||||
public function adminRemovesUserFromGroupUsingTheProvisioningApi(string $user, string $group): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
if (OcHelper::isTestingOnReva()) {
|
||||
@@ -1154,13 +1157,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the extra groups returned by the API should be$/
|
||||
*
|
||||
* @param TableNode $groupsList
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the extra groups returned by the API should be')]
|
||||
public function theExtraGroupsShouldBe(TableNode $groupsList): void {
|
||||
$this->verifyTableNodeColumnsCount($groupsList, 1);
|
||||
$groups = $groupsList->getRows();
|
||||
@@ -1248,7 +1251,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should belong to group "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $group
|
||||
@@ -1256,6 +1258,7 @@ trait Provisioning {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :user should belong to group :group')]
|
||||
public function userShouldBelongToGroup(string $user, string $group): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
if (OcHelper::isTestingOnReva()) {
|
||||
@@ -1286,13 +1289,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the following users should not belong to the following groups
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the following users should not belong to the following groups')]
|
||||
public function theTheFollowingUserShouldNotBelongToTheFollowingGroup(TableNode $table): void {
|
||||
$this->verifyTableNodeColumns($table, ["username", "groupname"]);
|
||||
$rows = $table->getHash();
|
||||
@@ -1321,13 +1324,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then group :group should not contain user :username
|
||||
*
|
||||
* @param string $group
|
||||
* @param string $username
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('group :group should not contain user :username')]
|
||||
public function groupShouldNotContainUser(string $group, string $username): void {
|
||||
$username = $this->getActualUsername($username);
|
||||
$fullUrl = $this->getBaseUrl() . "/ocs/v2.php/cloud/groups/$group";
|
||||
@@ -1341,7 +1344,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the administrator adds user "([^"]*)" to group "([^"]*)" using the provisioning API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $group
|
||||
@@ -1349,13 +1351,13 @@ trait Provisioning {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('the administrator adds user :user to group :group using the provisioning API')]
|
||||
public function adminAddsUserToGroupUsingTheProvisioningApi(string $user, string $group): void {
|
||||
$response = $this->graphContext->addUserToGroup($group, $user);
|
||||
$this->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has been added to group "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $group
|
||||
@@ -1363,6 +1365,7 @@ trait Provisioning {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has been added to group :group')]
|
||||
public function userHasBeenAddedToGroup(string $user, string $group): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
if ($this->isTestingWithLdap()) {
|
||||
@@ -1383,13 +1386,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the following users have been added to the following groups
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('the following users have been added to the following groups')]
|
||||
public function theFollowingUserHaveBeenAddedToTheFollowingGroup(TableNode $table): void {
|
||||
$this->verifyTableNodeColumns($table, ['username', 'groupname']);
|
||||
foreach ($table as $row) {
|
||||
@@ -1461,7 +1464,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^group "([^"]*)" has been created$/
|
||||
*
|
||||
* @param string $group
|
||||
*
|
||||
@@ -1469,6 +1471,7 @@ trait Provisioning {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('group :group has been created')]
|
||||
public function groupHasBeenCreated(string $group): void {
|
||||
$this->createTheGroup($group);
|
||||
Assert::assertTrue(
|
||||
@@ -1478,7 +1481,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given these groups have been created:
|
||||
* expects a table of groups with the heading "groupname"
|
||||
*
|
||||
* @param TableNode $table
|
||||
@@ -1486,6 +1488,7 @@ trait Provisioning {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('these groups have been created:')]
|
||||
public function theseGroupsHaveBeenCreated(TableNode $table): void {
|
||||
$this->verifyTableNodeColumns($table, ['groupname'], ['comment']);
|
||||
foreach ($table as $row) {
|
||||
@@ -1687,13 +1690,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has been disabled$/
|
||||
*
|
||||
* @param string|null $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has been disabled')]
|
||||
public function adminHasDisabledUserUsingTheProvisioningApi(?string $user): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
if (OcHelper::isTestingOnReva()) {
|
||||
@@ -1742,7 +1745,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^group "([^"]*)" has been deleted$/
|
||||
*
|
||||
* @param string $group
|
||||
*
|
||||
@@ -1750,6 +1752,7 @@ trait Provisioning {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('group :group has been deleted')]
|
||||
public function groupHasBeenDeleted(string $group): void {
|
||||
if ($this->isTestingWithLdap()) {
|
||||
$this->deleteLdapGroup($group);
|
||||
@@ -1795,7 +1798,6 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has been removed from group :group
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $group
|
||||
@@ -1803,6 +1805,7 @@ trait Provisioning {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has been removed from group :group')]
|
||||
public function adminHasRemovedUserFromGroup(string $user, string $group): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
if ($this->isTestingWithLdap()
|
||||
@@ -1836,13 +1839,13 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the users returned by the API should be$/
|
||||
*
|
||||
* @param TableNode $usersList
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the users returned by the API should be')]
|
||||
public function theUsersShouldBe(TableNode $usersList): void {
|
||||
$this->verifyTableNodeColumnsCount($usersList, 1);
|
||||
$users = $usersList->getRows();
|
||||
@@ -1906,11 +1909,11 @@ trait Provisioning {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the API should not return any data$/
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the API should not return any data')]
|
||||
public function theApiShouldNotReturnAnyData(): void {
|
||||
$responseData = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0];
|
||||
Assert::assertEmpty(
|
||||
|
||||
@@ -27,6 +27,9 @@ use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use TestHelpers\UploadHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -60,37 +63,37 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public downloads the last public link shared file using the public WebDAV API$/
|
||||
* @When /^the public tries to download the last public link shared file using the public WebDAV API$/
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public downloads the last public link shared file using the public WebDAV API')]
|
||||
#[When('the public tries to download the last public link shared file using the public WebDAV API')]
|
||||
public function downloadPublicFile(): void {
|
||||
$response = $this->downloadPublicFileWithRange("");
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public downloads the last public link shared file with password "([^"]*)" using the public WebDAV API$/
|
||||
* @When /^the public tries to download the last public link shared file with password "([^"]*)" using the public WebDAV API$/
|
||||
*
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public downloads the last public link shared file with password :password using the public WebDAV API')]
|
||||
#[When('the public tries to download the last public link shared file with password :password using the public WebDAV API')]
|
||||
public function downloadPublicFileWithPassword(string $password): void {
|
||||
$response = $this->downloadPublicFileWithRange("", $password);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" tries to download file "([^"]*)" from the last public link using own basic auth and public WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user tries to download file :path from the last public link using own basic auth and public WebDAV API')]
|
||||
public function userTriesToDownloadFileFromPublicLinkUsingBasicAuthAndPublicWebdav(
|
||||
string $user,
|
||||
string $path
|
||||
@@ -100,12 +103,12 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public deletes (?:file|folder|entry) "([^"]*)" from the last public link share using the public WebDAV API$/
|
||||
*
|
||||
* @param string $fileName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^the public deletes (?:file|folder|entry) "([^"]*)" from the last public link share using the public WebDAV API$/')]
|
||||
public function thePublicDeletesFileFolderFromTheLastPublicLinkShareUsingThePublicWebdavApi(
|
||||
string $fileName
|
||||
): void {
|
||||
@@ -147,13 +150,13 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the public has deleted (?:file|folder|entry) "([^"]*)" from the last link share with password "([^"]*)" using the public WebDAV API$/
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('/^the public has deleted (?:file|folder|entry) "([^"]*)" from the last link share with password "([^"]*)" using the public WebDAV API$/')]
|
||||
public function thePublicHasDeletedFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(
|
||||
string $file,
|
||||
string $password
|
||||
@@ -163,13 +166,13 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public deletes (?:file|folder|entry) "([^"]*)" from the last link share with password "([^"]*)" using the public WebDAV API$/
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^the public deletes (?:file|folder|entry) "([^"]*)" from the last link share with password "([^"]*)" using the public WebDAV API$/')]
|
||||
public function thePublicDeletesFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(
|
||||
string $file,
|
||||
string $password
|
||||
@@ -219,7 +222,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public renames (?:file|folder|entry) "([^"]*)" to "([^"]*)" from the last public link share using the password "([^"]*)" and the public WebDAV API$/
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param string $toName
|
||||
@@ -227,6 +229,7 @@ class PublicWebDavContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^the public renames (?:file|folder|entry) "([^"]*)" to "([^"]*)" from the last public link share using the password "([^"]*)" and the public WebDAV API$/')]
|
||||
public function thePublicRenamesFileFromTheLastPublicShareUsingThePasswordPasswordAndOldPublicWebdavApi(
|
||||
string $fileName,
|
||||
string $toName,
|
||||
@@ -239,14 +242,14 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public downloads file "([^"]*)" from inside the last public link shared folder with password "([^"]*)" using the public WebDAV API$/
|
||||
* @When /^the public tries to download file "([^"]*)" from inside the last public link shared folder with password "([^"]*)" using the public WebDAV API$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public downloads file :path from inside the last public link shared folder with password :password using the public WebDAV API')]
|
||||
#[When('the public tries to download file :path from inside the last public link shared folder with password :password using the public WebDAV API')]
|
||||
public function publicDownloadsFileFromInsideLastPublicSharedFolderWithPassword(
|
||||
string $path,
|
||||
string $password = ""
|
||||
@@ -376,13 +379,13 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public copies (?:file|folder) "([^"]*)" to "([^"]*)" using the public WebDAV API$/
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $destination
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^the public copies (?:file|folder) "([^"]*)" to "([^"]*)" using the public WebDAV API$/')]
|
||||
public function thePublicCopiesFileUsingTheWebDAVApi(string $source, string $destination): void {
|
||||
$token = ($this->featureContext->isUsingSharingNG())
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
@@ -424,7 +427,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the public has uploaded file "([^"]*)" with content "([^"]*)" and password "([^"]*)" to the last link share using the public WebDAV API$/
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $content
|
||||
@@ -432,6 +434,7 @@ class PublicWebDavContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('the public has uploaded file :filename with content :content and password :password to the last link share using the public WebDAV API')]
|
||||
public function thePublicHasUploadedFileWithContentAndPasswordToLastLinkShareUsingPublicWebdavApi(
|
||||
string $filename,
|
||||
string $content = 'test',
|
||||
@@ -446,7 +449,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public uploads file "([^"]*)" with password "([^"]*)" and content "([^"]*)" using the public WebDAV API$/
|
||||
*
|
||||
* @param string $filename target file name
|
||||
* @param string $password
|
||||
@@ -454,6 +456,7 @@ class PublicWebDavContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public uploads file :filename with password :password and content :body using the public WebDAV API')]
|
||||
public function thePublicUploadsFileWithPasswordAndContentUsingPublicWebDAVApi(
|
||||
string $filename,
|
||||
string $password,
|
||||
@@ -468,26 +471,26 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public overwrites file :filename with content :body using the public WebDAV API
|
||||
*
|
||||
* @param string $filename target file name
|
||||
* @param string $body content to upload
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public overwrites file :filename with content :body using the public WebDAV API')]
|
||||
public function thePublicOverwritesFileWithContentUsingWebDavApi(string $filename, string $body): void {
|
||||
$response = $this->publicUploadContent($filename, '', $body);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public uploads file "([^"]*)" with content "([^"]*)" using the public WebDAV API$/
|
||||
*
|
||||
* @param string $filename target file name
|
||||
* @param string $body content to upload
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public uploads file :filename with content :body using the public WebDAV API')]
|
||||
public function thePublicUploadsFileWithContentUsingThePublicWebDavApi(
|
||||
string $filename,
|
||||
string $body = 'test'
|
||||
@@ -498,20 +501,19 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the public has uploaded file :filename with content :body
|
||||
*
|
||||
* @param string $filename target file name
|
||||
* @param string $body content to upload
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('the public has uploaded file :filename with content :body')]
|
||||
public function thePublicHasUploadedFileWithContent(string $filename, string $body): void {
|
||||
$response = $this->publicUploadContent($filename, '', $body);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public should be able to download the last publicly shared file using the public WebDAV API with password "([^"]*)" and the content should be "([^"]*)"$/
|
||||
*
|
||||
* @param string $password
|
||||
* @param string $expectedContent
|
||||
@@ -519,6 +521,7 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the public should be able to download the last publicly shared file using the public WebDAV API with password :password and the content should be :expectedContent')]
|
||||
public function checkLastPublicSharedFileWithPasswordDownload(
|
||||
string $password,
|
||||
string $expectedContent
|
||||
@@ -538,14 +541,14 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public should not be able to download file "([^"]*)" from inside the last public link shared folder using the public WebDAV API without a password$/
|
||||
* @Then /^the public download of file "([^"]*)" from inside the last public link shared folder using the public WebDAV API should fail with HTTP status code "([^"]*)"$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $expectedHttpCode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the public should not be able to download file :path from inside the last public link shared folder using the public WebDAV API without a password')]
|
||||
#[Then('the public download of file :path from inside the last public link shared folder using the public WebDAV API should fail with HTTP status code :expectedHttpCode')]
|
||||
public function shouldNotBeAbleToDownloadFileInsidePublicSharedFolder(
|
||||
string $path,
|
||||
string $expectedHttpCode = "401"
|
||||
@@ -560,13 +563,13 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public should be able to download file "([^"]*)" from inside the last public link shared folder using the public WebDAV API with password "([^"]*)"$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the public should be able to download file :path from inside the last public link shared folder using the public WebDAV API with password :password')]
|
||||
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPassword(
|
||||
string $path,
|
||||
string $password
|
||||
@@ -581,7 +584,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public should be able to download file "([^"]*)" from inside the last public link shared folder using the public WebDAV API with password "([^"]*)" and the content should be "([^"]*)"$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $password
|
||||
@@ -590,6 +592,7 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the public should be able to download file :path from inside the last public link shared folder using the public WebDAV API with password :password and the content should be :content')]
|
||||
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordAndContentShouldBe(
|
||||
string $path,
|
||||
string $password,
|
||||
@@ -606,7 +609,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public should be able to download file "([^"]*)" from the last link share with password "([^"]*)" and the content should be "([^"]*)"$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $password
|
||||
@@ -615,6 +617,7 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the public should be able to download file :path from the last link share with password :password and the content should be :content')]
|
||||
public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordForSharingNGAndContentShouldBe(
|
||||
string $path,
|
||||
string $password,
|
||||
@@ -632,8 +635,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public should not be able to download file "([^"]*)" from inside the last public link shared folder using the public WebDAV API with password "([^"]*)"$/
|
||||
* @Then /^the public download of file "([^"]*)" from inside the last public link shared folder using the public WebDAV API with password "([^"]*)" should fail with HTTP status code "([^"]*)"$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $password
|
||||
@@ -641,6 +642,8 @@ class PublicWebDavContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the public should not be able to download file :path from inside the last public link shared folder using the public WebDAV API with password :password')]
|
||||
#[Then('the public download of file :path from inside the last public link shared folder using the public WebDAV API with password :password should fail with HTTP status code :expectedHttpCode')]
|
||||
public function shouldNotBeAbleToDownloadFileInsidePublicSharedFolderWithPassword(
|
||||
string $path,
|
||||
string $password,
|
||||
@@ -656,7 +659,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public download of file "([^"]*)" from the last link share with password "([^"]*)" should fail with HTTP status code "([^"]*)" using shareNg$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $password
|
||||
@@ -664,6 +666,7 @@ class PublicWebDavContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the public download of file :path from the last link share with password :password should fail with HTTP status code :expectedHttpCode using shareNg')]
|
||||
public function shouldNotBeAbleToDownloadFileWithPasswordForShareNg(
|
||||
string $path,
|
||||
string $password,
|
||||
@@ -704,7 +707,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public upload to the last publicly shared file using the public WebDAV API with password "([^"]*)" should (?:fail|pass) with HTTP status code "([^"]*)"$/
|
||||
*
|
||||
* @param string $password
|
||||
* @param string $expectedHttpCode
|
||||
@@ -712,6 +714,7 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the public upload to the last publicly shared file using the public WebDAV API with password "([^"]*)" should (?:fail|pass) with HTTP status code "([^"]*)"$/')]
|
||||
public function publiclyUploadingShouldToSharedFileShouldFail(
|
||||
string $password,
|
||||
string $expectedHttpCode
|
||||
@@ -727,13 +730,13 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public upload to the last publicly shared folder using the public WebDAV API with password "([^"]*)" should fail with HTTP status code "([^"]*)"$/
|
||||
*
|
||||
* @param string $password
|
||||
* @param string|null $expectedHttpCode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the public upload to the last publicly shared folder using the public WebDAV API with password :password should fail with HTTP status code :expectedHttpCode')]
|
||||
public function publiclyUploadingWithPasswordShouldNotWork(
|
||||
string $password,
|
||||
string $expectedHttpCode = null
|
||||
@@ -750,13 +753,13 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public should be able to upload file "([^"]*)" into the last public link shared folder using the public WebDAV API with password "([^"]*)"$/
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the public should be able to upload file :filename into the last public link shared folder using the public WebDAV API with password :password')]
|
||||
public function publiclyUploadingIntoFolderWithPasswordShouldWork(
|
||||
string $filename,
|
||||
string $password
|
||||
@@ -770,13 +773,13 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^uploading a file with password "([^"]*)" should work using the public WebDAV API$/
|
||||
*
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('uploading a file with password :password should work using the public WebDAV API')]
|
||||
public function publiclyUploadingShouldWork(string $password): void {
|
||||
$path = "whateverfilefortesting-publicWebDAVAPI.txt";
|
||||
$content = "test";
|
||||
@@ -802,7 +805,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^uploading content to a public link shared file with password "([^"]*)" should (not|)\s?work using the public WebDAV API$/
|
||||
*
|
||||
* @param string $password
|
||||
* @param string $shouldOrNot (not|)
|
||||
@@ -810,6 +812,7 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^uploading content to a public link shared file with password "([^"]*)" should (not|)\\s?work using the public WebDAV API$/')]
|
||||
public function publiclyUploadingToPublicLinkSharedFileShouldWork(
|
||||
string $password,
|
||||
string $shouldOrNot,
|
||||
@@ -851,13 +854,13 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public uploads file :source to :destination inside last link shared folder using the public WebDAV API
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $destination
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public uploads file :source to :destination inside last link shared folder using the public WebDAV API')]
|
||||
public function thePublicUploadsFileToInsideLastLinkSharedFolderUsingThePublicWebdavApi(
|
||||
string $source,
|
||||
string $destination,
|
||||
@@ -875,7 +878,6 @@ class PublicWebDavContext implements Context {
|
||||
|
||||
/**
|
||||
*
|
||||
* @When the public uploads file :source to :destination inside last link shared folder with password :password using the public WebDAV API
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $destination
|
||||
@@ -883,6 +885,7 @@ class PublicWebDavContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public uploads file :source to :destination inside last link shared folder with password :password using the public WebDAV API')]
|
||||
public function thePublicUploadsFileToInsideLastLinkSharedFolderWithPasswordUsingThePublicWebdavApi(
|
||||
string $source,
|
||||
string $destination,
|
||||
@@ -900,7 +903,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public uploads file :fileName to the last public link shared folder with password :password with mtime :mtime using the public WebDAV API
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param string $password
|
||||
@@ -909,6 +911,7 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('the public uploads file :fileName to the last public link shared folder with password :password with mtime :mtime using the public WebDAV API')]
|
||||
public function thePublicUploadsFileToLastSharedFolderWithMtimeUsingTheWebdavApi(
|
||||
string $fileName,
|
||||
string $password,
|
||||
@@ -964,24 +967,24 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public creates folder :destination using the public WebDAV API
|
||||
*
|
||||
* @param String $destination
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public creates folder :destination using the public WebDAV API')]
|
||||
public function publicCreatesFolder(string $destination): void {
|
||||
$this->featureContext->setResponse($this->publicCreatesFolderUsingPassword($destination, ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public should be able to create folder "([^"]*)" in the last public link shared folder using the new public WebDAV API with password "([^"]*)"$/
|
||||
*
|
||||
* @param string $foldername
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the public should be able to create folder :foldername in the last public link shared folder using the new public WebDAV API with password :password')]
|
||||
public function publicShouldBeAbleToCreateFolderWithPassword(
|
||||
string $foldername,
|
||||
string $password
|
||||
@@ -991,7 +994,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the public creation of folder "([^"]*)" in the last public link shared folder using the new public WebDAV API with password "([^"]*)" should fail with HTTP status code "([^"]*)"$/
|
||||
*
|
||||
* @param string $foldername
|
||||
* @param string $password
|
||||
@@ -999,6 +1001,7 @@ class PublicWebDavContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the public creation of folder :foldername in the last public link shared folder using the new public WebDAV API with password :password should fail with HTTP status code :expectedHttpCode')]
|
||||
public function publicCreationOfFolderWithPasswordShouldFail(
|
||||
string $foldername,
|
||||
string $password,
|
||||
@@ -1014,7 +1017,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the mtime of file :fileName in the last shared public link using the WebDAV API should be :mtime
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param string $mtime
|
||||
@@ -1022,6 +1024,7 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the mtime of file :fileName in the last shared public link using the WebDAV API should be :mtime')]
|
||||
public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldBe(
|
||||
string $fileName,
|
||||
string $mtime
|
||||
@@ -1045,7 +1048,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the mtime of file :fileName in the last shared public link using the WebDAV API should not be :mtime
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param string $mtime
|
||||
@@ -1053,6 +1055,7 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the mtime of file :fileName in the last shared public link using the WebDAV API should not be :mtime')]
|
||||
public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldNotBe(
|
||||
string $fileName,
|
||||
string $mtime
|
||||
@@ -1158,7 +1161,6 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public sends "([^"]*)" request to the last public link share using the public WebDAV API(?: with password "([^"]*)")?$/
|
||||
*
|
||||
* @param string $method
|
||||
* @param string|null $password
|
||||
@@ -1166,6 +1168,7 @@ class PublicWebDavContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('/^the public sends "([^"]*)" request to the last public link share using the public WebDAV API(?: with password "([^"]*)")?$/')]
|
||||
public function publicSendsRequestToLastPublicShare(string $method, ?string $password = ''): void {
|
||||
if ($method === "PROPFIND") {
|
||||
$body = '<?xml version="1.0"?>
|
||||
|
||||
@@ -27,6 +27,8 @@ use Psr\Http\Message\ResponseInterface;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -126,10 +128,6 @@ class SearchContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user searches for :pattern using the WebDAV API
|
||||
* @When user :user searches for :pattern and limits the results to :limit items using the WebDAV API
|
||||
* @When user :user searches for :pattern using the WebDAV API requesting these properties:
|
||||
* @When user :user searches for :pattern and limits the results to :limit items using the WebDAV API requesting these properties:
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $pattern
|
||||
@@ -139,6 +137,10 @@ class SearchContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[When('user :user searches for :pattern using the WebDAV API')]
|
||||
#[When('user :user searches for :pattern and limits the results to :limit items using the WebDAV API')]
|
||||
#[When('user :user searches for :pattern using the WebDAV API requesting these properties:')]
|
||||
#[When('user :user searches for :pattern and limits the results to :limit items using the WebDAV API requesting these properties:')]
|
||||
public function userSearchesUsingWebDavAPI(
|
||||
string $user,
|
||||
string $pattern,
|
||||
@@ -153,7 +155,6 @@ class SearchContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then file/folder :path in the search result of user :user should contain these properties:
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $user
|
||||
@@ -162,6 +163,7 @@ class SearchContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('file/folder :path in the search result of user :user should contain these properties:')]
|
||||
public function fileOrFolderInTheSearchResultShouldContainProperties(
|
||||
string $path,
|
||||
string $user,
|
||||
@@ -216,7 +218,6 @@ class SearchContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the search result should contain these (?:files|entries) with highlight on keyword "([^"]*)"/
|
||||
*
|
||||
* @param TableNode $expectedFiles
|
||||
* @param string $expectedContent
|
||||
@@ -225,6 +226,7 @@ class SearchContext implements Context {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the search result should contain these (?:files|entries) with highlight on keyword "([^"]*)"/')]
|
||||
public function theSearchResultShouldContainEntriesWithHighlight(
|
||||
TableNode $expectedFiles,
|
||||
string $expectedContent
|
||||
@@ -253,8 +255,6 @@ class SearchContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" searches for "([^"]*)" inside (folder|space) "([^"]*)" using the WebDAV API$/
|
||||
* @When /^user "([^"]*)" searches for "([^"]*)" inside (folder) "([^"]*)" in space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $pattern
|
||||
@@ -265,6 +265,8 @@ class SearchContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" searches for "([^"]*)" inside (folder|space) "([^"]*)" using the WebDAV API$/')]
|
||||
#[When('/^user "([^"]*)" searches for "([^"]*)" inside (folder) "([^"]*)" in space "([^"]*)" using the WebDAV API$/')]
|
||||
public function userSearchesInsideFolderOrSpaceUsingWebDavAPI(
|
||||
string $user,
|
||||
string $pattern,
|
||||
|
||||
@@ -16,6 +16,9 @@ use Psr\Http\Message\ResponseInterface;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\SettingsHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -60,7 +63,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" tries to get all existing roles using the settings API$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -69,6 +71,7 @@ class SettingsContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user tries to get all existing roles using the settings API')]
|
||||
public function getAllExistingRoles(string $user): void {
|
||||
$response = $this->getRoles($user);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -115,7 +118,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the administrator has given "([^"]*)" the role "([^"]*)" using the settings api$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $role
|
||||
@@ -124,6 +126,7 @@ class SettingsContext implements Context {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('the administrator has given :user the role :role using the settings api')]
|
||||
public function theAdministratorHasGivenUserTheRole(string $user, string $role): void {
|
||||
$admin = $this->featureContext->getAdminUserName();
|
||||
$roleId = $this->getRoleIdByRoleName($admin, $role);
|
||||
@@ -137,7 +140,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :assigner assigns the role :role to user :assignee using the settings API
|
||||
*
|
||||
* @param string $assigner
|
||||
* @param string $role
|
||||
@@ -147,6 +149,7 @@ class SettingsContext implements Context {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :assigner assigns the role :role to user :assignee using the settings API')]
|
||||
public function userAssignsTheRoleToUserUsingTheSettingsApi(
|
||||
string $assigner,
|
||||
string $role,
|
||||
@@ -218,7 +221,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" changes his own role to "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $role
|
||||
@@ -226,6 +228,7 @@ class SettingsContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user changes his own role to :role')]
|
||||
public function userChangeOwnRole(string $user, string $role): void {
|
||||
// we assume that the user knows uuid role.
|
||||
$roleId = $this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role);
|
||||
@@ -235,7 +238,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" changes the role "([^"]*)" for user "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $role
|
||||
@@ -244,6 +246,7 @@ class SettingsContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user changes the role :role for user :assignedUser')]
|
||||
public function userChangeRoleAnotherUser(string $user, string $role, string $assignedUser): void {
|
||||
// we assume that the user knows uuid role.
|
||||
$roleId = $this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role);
|
||||
@@ -253,7 +256,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" tries to get list of assignment using the settings API$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -262,13 +264,13 @@ class SettingsContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user tries to get list of assignment using the settings API')]
|
||||
public function userGetAssignmentsList(string $user): void {
|
||||
$userId = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$this->featureContext->setResponse($this->getAssignmentsList($user, $userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should have the role "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $role
|
||||
@@ -278,6 +280,7 @@ class SettingsContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :user should have the role :role')]
|
||||
public function userShouldHaveRole(string $user, string $role): void {
|
||||
$userId = $this->featureContext->getAttributeOfCreatedUser($user, 'id');
|
||||
$response = $this->getAssignmentsList($this->featureContext->getAdminUserName(), $userId);
|
||||
@@ -295,7 +298,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the setting API response should have the role "([^"]*)"$/
|
||||
*
|
||||
* @param string $role
|
||||
*
|
||||
@@ -303,6 +305,7 @@ class SettingsContext implements Context {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the setting API response should have the role :role')]
|
||||
public function theSettingApiResponseShouldHaveTheRole(string $role): void {
|
||||
$assignmentRoleId = $this->featureContext->getJsonDecodedResponse(
|
||||
$this->featureContext->getResponse()
|
||||
@@ -370,7 +373,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" lists values-list with headers using the Settings API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $headersTable
|
||||
@@ -380,6 +382,7 @@ class SettingsContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user lists values-list with headers using the Settings API')]
|
||||
public function theUserListsAllValuesListWithHeadersUsingSettingsApi(string $user, TableNode $headersTable): void {
|
||||
$this->featureContext->verifyTableNodeColumns(
|
||||
$headersTable,
|
||||
@@ -446,7 +449,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has switched the system language to "([^"]*)" using the settings API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $language
|
||||
@@ -456,6 +458,7 @@ class SettingsContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has switched the system language to :language using the settings API')]
|
||||
public function theUserHasSwitchedSystemLanguage(string $user, string $language): void {
|
||||
$response = $this->sendRequestToSwitchSystemLanguage($user, $language);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
@@ -466,7 +469,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user switches the system language to :language using the settings API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $language
|
||||
@@ -476,6 +478,7 @@ class SettingsContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user switches the system language to :language using the settings API')]
|
||||
public function userSwitchesTheSystemLanguageUsingTheSettingsApi(string $user, string $language): void {
|
||||
$response = $this->sendRequestToSwitchSystemLanguage($user, $language);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -515,8 +518,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has disabled auto-accepting
|
||||
* @Given user :user has disabled the auto-sync share
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -525,6 +526,8 @@ class SettingsContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has disabled auto-accepting')]
|
||||
#[Given('user :user has disabled the auto-sync share')]
|
||||
public function theUserHasDisabledAutoAccepting(string $user): void {
|
||||
$response = $this->sendRequestToDisableAutoAccepting($user);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
@@ -536,7 +539,6 @@ class SettingsContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user disables the auto-sync share using the settings API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -545,6 +547,7 @@ class SettingsContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user disables the auto-sync share using the settings API')]
|
||||
public function userDisablesAutoAcceptingUsingSettingsApi(string $user): void {
|
||||
$response = $this->sendRequestToDisableAutoAccepting($user);
|
||||
$this->featureContext->setResponse($response);
|
||||
|
||||
@@ -27,6 +27,8 @@ use Psr\Http\Message\ResponseInterface;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use TestHelpers\BehatHelper;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -38,13 +40,13 @@ class ShareesContext implements Context {
|
||||
private OCSContext $ocsContext;
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the sharees using the sharing API with parameters$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user gets the sharees using the sharing API with parameters')]
|
||||
public function userGetsTheShareesWithParameters(string $user, TableNode $body): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->getShareesWithParameters(
|
||||
@@ -55,7 +57,6 @@ class ShareesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the "([^"]*)" sharees returned should be$/
|
||||
*
|
||||
* @param string $shareeType
|
||||
* @param TableNode $shareesList
|
||||
@@ -63,6 +64,7 @@ class ShareesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the :shareeType sharees returned should be')]
|
||||
public function theShareesReturnedShouldBe(string $shareeType, TableNode $shareesList): void {
|
||||
$this->featureContext->verifyTableNodeColumnsCount($shareesList, 4);
|
||||
$sharees = $shareesList->getRows();
|
||||
@@ -78,7 +80,6 @@ class ShareesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the "([^"]*)" sharees returned should include$/
|
||||
*
|
||||
* @param string $shareeType
|
||||
* @param TableNode $shareesList
|
||||
@@ -86,6 +87,7 @@ class ShareesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the :shareeType sharees returned should include')]
|
||||
public function theShareesReturnedShouldInclude(string $shareeType, TableNode $shareesList): void {
|
||||
$this->featureContext->verifyTableNodeColumnsCount($shareesList, 3);
|
||||
$sharees = $shareesList->getRows();
|
||||
@@ -103,12 +105,12 @@ class ShareesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the "([^"]*)" sharees returned should be empty$/
|
||||
*
|
||||
* @param string $shareeType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the :shareeType sharees returned should be empty')]
|
||||
public function theShareesReturnedShouldBeEmpty(string $shareeType): void {
|
||||
$respondedArray = $this->getArrayOfShareesResponded(
|
||||
$this->featureContext->getResponse(),
|
||||
|
||||
@@ -30,6 +30,9 @@ use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\TranslationHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
/**
|
||||
* Sharing trait
|
||||
@@ -213,7 +216,7 @@ trait Sharing {
|
||||
throw new Error(
|
||||
'Response did not contain share id '
|
||||
. $this->getJsonDecodedResponse($lastResponse)['link']['webUrl']
|
||||
. ' for the created public link'
|
||||
. ' for the created public link'
|
||||
);
|
||||
}
|
||||
$last_created_link_webURL = $this->getJsonDecodedResponse($lastResponse)['link']['webUrl'];
|
||||
@@ -389,7 +392,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" creates a share using the sharing API with settings$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode|null $body {@link createShareWithSettings}
|
||||
@@ -397,6 +399,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user creates a share using the sharing API with settings')]
|
||||
public function userCreatesAShareWithSettings(string $user, ?TableNode $body): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$response = $this->createShareWithSettings(
|
||||
@@ -422,7 +425,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" creates a public link share using the sharing API with settings$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -430,6 +432,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user creates a public link share using the sharing API with settings')]
|
||||
public function userCreatesAPublicLinkShareWithSettings(string $user, TableNode $body): void {
|
||||
$this->setResponse($this->createPublicLinkShare($user, $body));
|
||||
$this->pushToLastStatusCodesArrays();
|
||||
@@ -572,7 +575,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" updates the last share using the sharing API with$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode|null $body
|
||||
@@ -580,13 +582,13 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user updates the last share using the sharing API with')]
|
||||
public function userUpdatesTheLastShareWith(string $user, ?TableNode $body): void {
|
||||
$this->setResponse($this->updateLastShareWithSettings($user, $body));
|
||||
$this->pushToLastStatusCodesArrays();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" updates the last public link share using the sharing API with$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode|null $body
|
||||
@@ -594,13 +596,13 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user updates the last public link share using the sharing API with')]
|
||||
public function userUpdatesTheLastPublicLinkShareWith(string $user, ?TableNode $body): void {
|
||||
$this->response = $this->updateLastShareWithSettings($user, $body, null, true);
|
||||
$this->pushToLastStatusCodesArrays();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has updated the last share with$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode|null $body
|
||||
@@ -608,6 +610,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has updated the last share with')]
|
||||
public function userHasUpdatedTheLastShareWith(string $user, ?TableNode $body): void {
|
||||
$response = $this->updateLastShareWithSettings($user, $body);
|
||||
$this->theHTTPStatusCodeShouldBeBetween(200, 299, $response);
|
||||
@@ -803,10 +806,10 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then no files or folders should be included in the response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('no files or folders should be included in the response')]
|
||||
public function checkNoFilesFoldersInResponse(): void {
|
||||
$data = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0];
|
||||
Assert::assertIsObject($data, __METHOD__ . " data not found in response XML");
|
||||
@@ -814,12 +817,12 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then exactly :count file/files or folder/folders should be included in the response
|
||||
*
|
||||
* @param string $count
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('exactly :count file/files or folder/folders should be included in the response')]
|
||||
public function checkCountFilesFoldersInResponse(string $count): void {
|
||||
$count = (int) $count;
|
||||
$data = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0];
|
||||
@@ -828,13 +831,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(?:file|folder|entry) "([^"]*)" should be included in the response$/
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^(?:file|folder|entry) "([^"]*)" should be included in the response$/')]
|
||||
public function checkSharedFileInResponse(string $filename): void {
|
||||
$filename = "/" . \ltrim($filename, '/');
|
||||
Assert::assertTrue(
|
||||
@@ -844,13 +847,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(?:file|folder|entry) "([^"]*)" should not be included in the response$/
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^(?:file|folder|entry) "([^"]*)" should not be included in the response$/')]
|
||||
public function checkSharedFileNotInResponse(string $filename): void {
|
||||
$filename = "/" . \ltrim($filename, '/');
|
||||
Assert::assertFalse(
|
||||
@@ -860,13 +863,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(?:file|folder|entry) "([^"]*)" should be included as path in the response$/
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^(?:file|folder|entry) "([^"]*)" should be included as path in the response$/')]
|
||||
public function checkSharedFileAsPathInResponse(string $filename): void {
|
||||
$filename = "/" . \ltrim($filename, '/');
|
||||
Assert::assertTrue(
|
||||
@@ -876,13 +879,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(?:file|folder|entry) "([^"]*)" should not be included as path in the response$/
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^(?:file|folder|entry) "([^"]*)" should not be included as path in the response$/')]
|
||||
public function checkSharedFileAsPathNotInResponse(string $filename): void {
|
||||
$filename = "/" . \ltrim($filename, '/');
|
||||
Assert::assertFalse(
|
||||
@@ -892,7 +895,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(user|group) "([^"]*)" should be included in the response$/
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $user
|
||||
@@ -900,6 +902,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^(user|group) "([^"]*)" should be included in the response$/')]
|
||||
public function checkSharedUserOrGroupInResponse(string $type, string $user): void {
|
||||
if ($type === 'user') {
|
||||
$user = $this->getActualUsername($user);
|
||||
@@ -911,14 +914,14 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should not be included in the response$/
|
||||
* @Then /^group "([^"]*)" should not be included in the response$/
|
||||
*
|
||||
* @param string $userOrGroup
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :userOrGroup should not be included in the response')]
|
||||
#[Then('group :userOrGroup should not be included in the response')]
|
||||
public function checkSharedUserOrGroupNotInResponse(string $userOrGroup): void {
|
||||
Assert::assertFalse(
|
||||
$this->isFieldInResponse('share_with', "$userOrGroup", false),
|
||||
@@ -953,8 +956,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" shares (?:file|folder|entry) "([^"]*)" with user "([^"]*)"(?: with permissions (\d+))? using the sharing API$/
|
||||
* @When /^user "([^"]*)" shares (?:file|folder|entry) "([^"]*)" with user "([^"]*)" with permissions "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $filepath
|
||||
@@ -963,6 +964,8 @@ trait Sharing {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" shares (?:file|folder|entry) "([^"]*)" with user "([^"]*)"(?: with permissions (\\d+))? using the sharing API$/')]
|
||||
#[When('/^user "([^"]*)" shares (?:file|folder|entry) "([^"]*)" with user "([^"]*)" with permissions "([^"]*)" using the sharing API$/')]
|
||||
public function userSharesFileWithUserUsingTheSharingApi(
|
||||
string $sharer,
|
||||
string $filepath,
|
||||
@@ -980,8 +983,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" shares the following (?:files|folders|entries) with user "([^"]*)"(?: with permissions (\d+))? using the sharing API$/
|
||||
* @When /^user "([^"]*)" shares the following (?:files|folders|entries) with user "([^"]*)" with permissions "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $sharee
|
||||
@@ -991,6 +992,8 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" shares the following (?:files|folders|entries) with user "([^"]*)"(?: with permissions (\\d+))? using the sharing API$/')]
|
||||
#[When('/^user "([^"]*)" shares the following (?:files|folders|entries) with user "([^"]*)" with permissions "([^"]*)" using the sharing API$/')]
|
||||
public function userSharesTheFollowingFilesWithUserUsingTheSharingApi(
|
||||
string $sharer,
|
||||
string $sharee,
|
||||
@@ -1013,8 +1016,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the user shares (?:file|folder|entry) "([^"]*)" with user "([^"]*)"(?: with permissions (\d+))? using the sharing API$/
|
||||
* @When /^the user shares (?:file|folder|entry) "([^"]*)" with user "([^"]*)" with permissions "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $filepath
|
||||
* @param string $user2
|
||||
@@ -1022,6 +1023,8 @@ trait Sharing {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^the user shares (?:file|folder|entry) "([^"]*)" with user "([^"]*)"(?: with permissions (\\d+))? using the sharing API$/')]
|
||||
#[When('/^the user shares (?:file|folder|entry) "([^"]*)" with user "([^"]*)" with permissions "([^"]*)" using the sharing API$/')]
|
||||
public function theUserSharesFileWithUserUsingTheSharingApi(
|
||||
string $filepath,
|
||||
string $user2,
|
||||
@@ -1064,8 +1067,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" shares (?:file|folder|entry) "([^"]*)" with group "([^"]*)" with permissions "([^"]*)" using the sharing API$/
|
||||
* @When /^user "([^"]*)" shares (?:file|folder|entry) "([^"]*)" with group "([^"]*)"(?: with permissions (\d+))? using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $filepath
|
||||
@@ -1074,6 +1075,8 @@ trait Sharing {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" shares (?:file|folder|entry) "([^"]*)" with group "([^"]*)" with permissions "([^"]*)" using the sharing API$/')]
|
||||
#[When('/^user "([^"]*)" shares (?:file|folder|entry) "([^"]*)" with group "([^"]*)"(?: with permissions (\\d+))? using the sharing API$/')]
|
||||
public function userSharesFileWithGroupUsingTheSharingApi(
|
||||
string $user,
|
||||
string $filepath,
|
||||
@@ -1091,8 +1094,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" shares the following (?:files|folders|entries) with group "([^"]*)"(?: with permissions (\d+))? using the sharing API$/
|
||||
* @When /^user "([^"]*)" shares the following (?:files|folders|entries) with group "([^"]*)" with permissions "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $group
|
||||
@@ -1102,6 +1103,8 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" shares the following (?:files|folders|entries) with group "([^"]*)"(?: with permissions (\\d+))? using the sharing API$/')]
|
||||
#[When('/^user "([^"]*)" shares the following (?:files|folders|entries) with group "([^"]*)" with permissions "([^"]*)" using the sharing API$/')]
|
||||
public function userSharesTheFollowingFilesWithGroupUsingTheSharingApi(
|
||||
string $user,
|
||||
string $group,
|
||||
@@ -1124,8 +1127,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should not be able to share (?:file|folder|entry) "([^"]*)" with (user|group) "([^"]*)"(?: with permissions (\d+))? using the sharing API$/
|
||||
* @Then /^user "([^"]*)" should not be able to share (?:file|folder|entry) "([^"]*)" with (user|group) "([^"]*)" with permissions "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $filepath
|
||||
@@ -1136,6 +1137,8 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^user "([^"]*)" should not be able to share (?:file|folder|entry) "([^"]*)" with (user|group) "([^"]*)"(?: with permissions (\\d+))? using the sharing API$/')]
|
||||
#[Then('/^user "([^"]*)" should not be able to share (?:file|folder|entry) "([^"]*)" with (user|group) "([^"]*)" with permissions "([^"]*)" using the sharing API$/')]
|
||||
public function userTriesToShareFileUsingTheSharingApi(
|
||||
string $sharer,
|
||||
string $filepath,
|
||||
@@ -1161,8 +1164,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should be able to share (?:file|folder|entry) "([^"]*)" with (user|group) "([^"]*)"(?: with permissions (\d+))? using the sharing API$/
|
||||
* @Then /^user "([^"]*)" should be able to share (?:file|folder|entry) "([^"]*)" with (user|group) "([^"]*)" with permissions "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $filepath
|
||||
@@ -1173,6 +1174,8 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^user "([^"]*)" should be able to share (?:file|folder|entry) "([^"]*)" with (user|group) "([^"]*)"(?: with permissions (\\d+))? using the sharing API$/')]
|
||||
#[Then('/^user "([^"]*)" should be able to share (?:file|folder|entry) "([^"]*)" with (user|group) "([^"]*)" with permissions "([^"]*)" using the sharing API$/')]
|
||||
public function userShouldBeAbleToShareUsingTheSharingApi(
|
||||
string $sharer,
|
||||
string $filepath,
|
||||
@@ -1238,38 +1241,38 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" deletes the last share using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user deletes the last share using the sharing API')]
|
||||
public function userDeletesLastShareUsingTheSharingApi(string $user): void {
|
||||
$this->setResponse($this->deleteLastShareUsingSharingApi($user));
|
||||
$this->pushToLastStatusCodesArrays();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" deletes the last share of user "([^"]*)" using the sharing API$/
|
||||
* @When /^user "([^"]*)" tries to delete the last share of user "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $sharer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user deletes the last share of user :sharer using the sharing API')]
|
||||
#[When('user :user tries to delete the last share of user :sharer using the sharing API')]
|
||||
public function userDeletesLastShareOfUserUsingTheSharingApi(string $user, string $sharer): void {
|
||||
$this->setResponse($this->deleteLastShareUsingSharingApi($user, $sharer));
|
||||
$this->pushToLastStatusCodesArrays();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has deleted the last share$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has deleted the last share')]
|
||||
public function userHasDeletedLastShareUsingTheSharingApi(string $user): void {
|
||||
$response = $this->deleteLastShareUsingSharingApi($user);
|
||||
$this->theHTTPStatusCodeShouldBeBetween(200, 299, $response);
|
||||
@@ -1300,13 +1303,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the info of the last share using the sharing API$/
|
||||
*
|
||||
* @param string $user username that requests the information (might not be the user that has initiated the share)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user gets the info of the last share using the sharing API')]
|
||||
public function userGetsInfoOfLastShareUsingTheSharingApi(string $user): void {
|
||||
$response = $this->getLastShareInfo($user, "user");
|
||||
$this->setResponse($response);
|
||||
@@ -1314,13 +1317,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the info of the last public link share using the sharing API$/
|
||||
*
|
||||
* @param string $user username that requests the information (might not be the user that has initiated the share)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user gets the info of the last public link share using the sharing API')]
|
||||
public function userGetsInfoOfLastPublicLinkShareUsingTheSharingApi(string $user): void {
|
||||
$response = $this->getLastShareInfo($user, "link");
|
||||
$this->setResponse($response);
|
||||
@@ -1328,7 +1331,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as "([^"]*)" the info about the last share by user "([^"]*)" with user "([^"]*)" should include$/
|
||||
*
|
||||
* @param string $requester
|
||||
* @param string $sharer
|
||||
@@ -1338,6 +1340,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('as :requester the info about the last share by user :sharer with user :sharee should include')]
|
||||
public function asLastShareInfoAboutUserSharingWithUserShouldInclude(
|
||||
string $requester,
|
||||
string $sharer,
|
||||
@@ -1392,18 +1395,17 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets all the shares shared with him/her using the sharing API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user gets all the shares shared with him/her using the sharing API')]
|
||||
public function userGetsAllTheSharesSharedWithHimUsingTheSharingApi(string $user): void {
|
||||
$this->setResponse($this->getSharedWithMeShares($user));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then as user :user the last share should include the following properties:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -1411,6 +1413,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('as user :user the last share should include the following properties:')]
|
||||
public function userGetsTheLastShareSharedWithHimUsingTheSharingApi(string $user, TableNode $table): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$this->verifyTableNodeRows($table, [], $this->shareResponseFields);
|
||||
@@ -1436,7 +1439,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the (|pending)\s?(user|group|user and group|public link) shares shared with (?:him|her) using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $pending
|
||||
@@ -1444,6 +1446,7 @@ trait Sharing {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets the (|pending)\\s?(user|group|user and group|public link) shares shared with (?:him|her) using the sharing API$/')]
|
||||
public function userGetsFilteredSharesSharedWithHimUsingTheSharingApi(
|
||||
string $user,
|
||||
string $pending,
|
||||
@@ -1474,13 +1477,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets all the shares shared with (?:him|her|them) that are received as (?:file|folder|entry) "([^"]*)" using the provisioning API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets all the shares shared with (?:him|her|them) that are received as (?:file|folder|entry) "([^"]*)" using the provisioning API$/')]
|
||||
public function userGetsAllSharesSharedWithHimFromFileOrFolderUsingTheProvisioningApi(
|
||||
string $user,
|
||||
string $path
|
||||
@@ -1522,33 +1525,33 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets all shares shared by (?:him|her) using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets all shares shared by (?:him|her) using the sharing API$/')]
|
||||
public function userGetsAllSharesSharedByHimUsingTheSharingApi(string $user): void {
|
||||
$this->setResponse($this->getAllshares($user));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the administrator gets all shares shared by (?:him|her) using the sharing API$/
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^the administrator gets all shares shared by (?:him|her) using the sharing API$/')]
|
||||
public function theAdministratorGetsAllSharesSharedByHimUsingTheSharingApi(): void {
|
||||
$this->setResponse($this->getAllShares($this->getAdminUsername()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the (user|group|user and group|public link) shares shared by (?:him|her) using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $shareType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets the (user|group|user and group|public link) shares shared by (?:him|her) using the sharing API$/')]
|
||||
public function userGetsFilteredSharesSharedByHimUsingTheSharingApi(string $user, string $shareType): void {
|
||||
if ($shareType === 'public link') {
|
||||
$shareType = 'public_link';
|
||||
@@ -1562,23 +1565,23 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets all the shares of the file :path using the sharing API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user gets all the shares of the file :path using the sharing API')]
|
||||
public function userGetsAllTheSharesFromTheFileUsingTheSharingApi(string $user, string $path): void {
|
||||
$this->setResponse($this->getAllShares($user, "?path=$path"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the last share_id should be included in the response/
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the last share_id should be included in the response/')]
|
||||
public function checkingLastShareIDIsIncluded(): void {
|
||||
$shareId = ($this->isUsingSharingNG())
|
||||
? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId();
|
||||
@@ -1590,11 +1593,11 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the last share id should not be included in the response/
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the last share id should not be included in the response/')]
|
||||
public function checkLastShareIDIsNotIncluded(): void {
|
||||
$shareId = $this->isUsingSharingNG()
|
||||
? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId();
|
||||
@@ -1636,13 +1639,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should not see the share id of the last share
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('user :user should not see the share id of the last share')]
|
||||
public function userShouldNotSeeShareIdOfLastShare(string $user): void {
|
||||
$response = $this->getSharedWithMeShares($user);
|
||||
$this->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
@@ -1656,12 +1659,12 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should not have any received shares
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('user :user should not have any received shares')]
|
||||
public function userShouldNotHaveAnyReceivedShares(string $user): void {
|
||||
$response = $this->getSharedWithMeShares($user);
|
||||
$this->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
@@ -1669,12 +1672,12 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the response should contain ([0-9]+) entries$/
|
||||
*
|
||||
* @param int $count
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('/^the response should contain ([0-9]+) entries$/')]
|
||||
public function checkingTheResponseEntriesCount(int $count): void {
|
||||
$actualCount = \count(HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0]);
|
||||
Assert::assertEquals(
|
||||
@@ -1685,7 +1688,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the fields of the last response to user :user should include
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode|null $body
|
||||
@@ -1693,6 +1695,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the fields of the last response to user :user should include')]
|
||||
public function checkFields(string $user, ?TableNode $body): void {
|
||||
$this->checkTheFields($user, $body);
|
||||
}
|
||||
@@ -1734,7 +1737,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the fields of the last response to user :user and space :space should include
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
@@ -1743,6 +1745,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the fields of the last response to user :user and space :space should include')]
|
||||
public function checkFieldsOfSpaceSharingResponse(string $user, string $space, ?TableNode $body): void {
|
||||
$this->verifyTableNodeColumnsCount($body, 2);
|
||||
|
||||
@@ -1798,7 +1801,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the fields of the last response (?:to|about) user "([^"]*)" sharing with (?:user|group) "([^"]*)" should include$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $sharee
|
||||
@@ -1807,6 +1809,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the fields of the last response (?:to|about) user "([^"]*)" sharing with (?:user|group) "([^"]*)" should include$/')]
|
||||
public function checkFieldsOfLastResponseToUser(string $sharer, string $sharee, ?TableNode $body): void {
|
||||
$this->checkTheFieldsOfLastResponseToUser($sharer, $sharee, $body);
|
||||
}
|
||||
@@ -1875,13 +1878,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the fields of the last response should not include
|
||||
*
|
||||
* @param TableNode|null $body
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the fields of the last response should not include')]
|
||||
public function checkFieldsNotInResponse(?TableNode $body): void {
|
||||
$this->verifyTableNodeColumnsCount($body, 2);
|
||||
$bodyRows = $body->getRowsHash();
|
||||
@@ -1925,7 +1928,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as user "([^"]*)" the public shares of (?:file|folder) "([^"]*)" should be$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -1934,6 +1936,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^as user "([^"]*)" the public shares of (?:file|folder) "([^"]*)" should be$/')]
|
||||
public function checkPublicShares(string $user, string $path, ?TableNode $TableNode): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$response = $this->getShares($user, $path);
|
||||
@@ -1975,7 +1978,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as user "([^"]*)" the (?:file|folder) "([^"]*)" should not have any shares$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -1983,6 +1985,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^as user "([^"]*)" the (?:file|folder) "([^"]*)" should not have any shares$/')]
|
||||
public function checkPublicSharesAreEmpty(string $user, string $path): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$response = $this->getShares($user, $path);
|
||||
@@ -2037,7 +2040,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" deletes public link share named "([^"]*)" in (?:file|folder) "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $name
|
||||
@@ -2045,6 +2047,7 @@ trait Sharing {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" deletes public link share named "([^"]*)" in (?:file|folder) "([^"]*)" using the sharing API$/')]
|
||||
public function userDeletesPublicLinkShareNamedUsingTheSharingApi(
|
||||
string $user,
|
||||
string $name,
|
||||
@@ -2124,7 +2127,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" (declines|accepts) share "([^"]*)" offered by user "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $action
|
||||
@@ -2135,6 +2137,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" (declines|accepts) share "([^"]*)" offered by user "([^"]*)" using the sharing API$/')]
|
||||
public function userReactsToShareOfferedBy(
|
||||
string $user,
|
||||
string $action,
|
||||
@@ -2153,7 +2156,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" (declines|accepts) the already (?:accepted|declined) share "([^"]*)" offered by user "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $action
|
||||
@@ -2164,6 +2166,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" (declines|accepts) the already (?:accepted|declined) share "([^"]*)" offered by user "([^"]*)" using the sharing API$/')]
|
||||
public function userAcceptsTheAlreadyAcceptedShareOfferedByUsingTheSharingApi(
|
||||
string $user,
|
||||
string $action,
|
||||
@@ -2182,7 +2185,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" (declines|accepts) the following shares offered by user "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $action
|
||||
@@ -2192,6 +2194,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" (declines|accepts) the following shares offered by user "([^"]*)" using the sharing API$/')]
|
||||
public function userReactsToTheFollowingSharesOfferedBy(
|
||||
string $user,
|
||||
string $action,
|
||||
@@ -2215,7 +2218,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" (declines|accepts) share with ID "([^"]*)" using the sharing API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $action
|
||||
@@ -2224,6 +2226,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" (declines|accepts) share with ID "([^"]*)" using the sharing API$/')]
|
||||
public function userReactsToShareWithShareIDOfferedBy(string $user, string $action, string $share_id): void {
|
||||
$user = $this->getActualUsername($user);
|
||||
|
||||
@@ -2247,7 +2250,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has (declined|accepted) share "([^"]*)" offered by user "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $action
|
||||
@@ -2257,6 +2259,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has (declined|accepted) share "([^"]*)" offered by user "([^"]*)"$/')]
|
||||
public function userHasReactedToShareOfferedBy(
|
||||
string $user,
|
||||
string $action,
|
||||
@@ -2284,7 +2287,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should be able to (decline|accept) pending share "([^"]*)" offered by user "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $action
|
||||
@@ -2294,6 +2296,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^user "([^"]*)" should be able to (decline|accept) pending share "([^"]*)" offered by user "([^"]*)"$/')]
|
||||
public function userShouldBeAbleToAcceptShareOfferedBy(
|
||||
string $user,
|
||||
string $action,
|
||||
@@ -2321,7 +2324,6 @@ trait Sharing {
|
||||
|
||||
/**
|
||||
*
|
||||
* @Then /^the sharing API should report to user "([^"]*)" that these shares are in the (pending|accepted|declined) state$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $state
|
||||
@@ -2331,6 +2333,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the sharing API should report to user "([^"]*)" that these shares are in the (pending|accepted|declined) state$/')]
|
||||
public function assertSharesOfUserAreInState(string $user, string $state, TableNode $table): void {
|
||||
$this->verifyTableNodeColumns($table, ["path"], $this->shareResponseFields);
|
||||
$usersShares = $this->getAllSharesSharedWithUser($user, $state);
|
||||
@@ -2359,7 +2362,6 @@ trait Sharing {
|
||||
|
||||
/**
|
||||
*
|
||||
* @Then /^the sharing API should report to user "([^"]*)" that no shares are in the (pending|accepted|declined) state$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $state
|
||||
@@ -2367,6 +2369,7 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the sharing API should report to user "([^"]*)" that no shares are in the (pending|accepted|declined) state$/')]
|
||||
public function assertNoSharesOfUserAreInState(string $user, string $state): void {
|
||||
$usersShares = $this->getAllSharesSharedWithUser($user, $state);
|
||||
Assert::assertEmpty(
|
||||
@@ -2407,7 +2410,6 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" unshares (?:folder|file|entity) "([^"]*)" shared to "([^"]*)"$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $path
|
||||
@@ -2416,19 +2418,20 @@ trait Sharing {
|
||||
* @return void
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" unshares (?:folder|file|entity) "([^"]*)" shared to "([^"]*)"$/')]
|
||||
public function userUnsharesResourceSharedTo(string $sharer, string $path, string $sharee): void {
|
||||
$response = $this->unshareResourceSharedTo($sharer, $path, $sharee);
|
||||
$this->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the sharing API should report that no shares are shared with user :user
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the sharing API should report that no shares are shared with user :user')]
|
||||
public function assertThatNoSharesAreSharedWithUser(string $user): void {
|
||||
$usersShares = $this->getAllSharesSharedWithUser($user);
|
||||
Assert::assertEmpty(
|
||||
@@ -2438,13 +2441,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets share with id :share using the sharing API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $share_id
|
||||
*
|
||||
* @return ResponseInterface|null
|
||||
*/
|
||||
#[When('user :user gets share with id :share using the sharing API')]
|
||||
public function userGetsTheLastShareWithTheShareIdUsingTheSharingApi(
|
||||
string $user,
|
||||
string $share_id
|
||||
@@ -2530,12 +2533,12 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public accesses the preview of file :path from the last shared public link using the sharing API
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public accesses the preview of file :path from the last shared public link using the sharing API')]
|
||||
public function thePublicAccessesThePreviewOfTheSharedFileUsingTheSharingApi(string $path): void {
|
||||
$token = ($this->isUsingSharingNG())
|
||||
? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken();
|
||||
@@ -2545,13 +2548,13 @@ trait Sharing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public accesses the preview of the following files from the last shared public link using the sharing API
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @throws Exception
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public accesses the preview of the following files from the last shared public link using the sharing API')]
|
||||
public function thePublicAccessesThePreviewOfTheFollowingSharedFileUsingTheSharingApi(
|
||||
TableNode $table
|
||||
): void {
|
||||
|
||||
@@ -29,6 +29,9 @@ use TestHelpers\GraphHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -209,7 +212,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets permissions list for (folder|file) "([^"]*)" of the space "([^"]*)" using the Graph API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
@@ -219,6 +221,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets permissions list for (folder|file) "([^"]*)" of the space "([^"]*)" using the Graph API$/')]
|
||||
public function userGetsPermissionsListForResourceOfTheSpaceUsingTheGraphAPI(
|
||||
string $user,
|
||||
string $fileOrFolder,
|
||||
@@ -231,7 +234,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" lists the permissions of space "([^"]*)" using permissions endpoint of the Graph API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
@@ -239,6 +241,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user lists the permissions of space :space using permissions endpoint of the Graph API')]
|
||||
public function userListsThePermissionsOfSpaceUsingTheGraphApi(string $user, string $space): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->getPermissionsList($user, 'folder', $space)
|
||||
@@ -246,7 +249,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" tries to list the permissions of space "([^"]*)" owned by "([^"]*)" using permissions endpoint of the Graph API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
@@ -255,6 +257,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user tries to list the permissions of space :space owned by :spaceOwner using permissions endpoint of the Graph API')]
|
||||
public function userTriesToListThePermissionsOfSpaceUsingPermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
string $space,
|
||||
@@ -439,7 +442,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has sent the following resource share invitation:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -448,6 +450,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has sent the following resource share invitation:')]
|
||||
public function userHasSentTheFollowingResourceShareInvitation(string $user, TableNode $table): void {
|
||||
$rows = $table->getRowsHash();
|
||||
Assert::assertArrayHasKey(
|
||||
@@ -460,7 +463,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has sent the following resource share invitation to federated user:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -469,6 +471,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has sent the following resource share invitation to federated user:')]
|
||||
public function userHasSentTheFollowingResourceShareInvitationToFederatedUser(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -484,7 +487,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has sent the following space share invitation:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -493,6 +495,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has sent the following space share invitation:')]
|
||||
public function userHasSentTheFollowingShareShareInvitation(string $user, TableNode $table): void {
|
||||
$rows = $table->getRowsHash();
|
||||
Assert::assertArrayNotHasKey(
|
||||
@@ -505,8 +508,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends the following resource share invitation using the Graph API:$/
|
||||
* @When /^user "([^"]*)" tries to send the following resource share invitation using the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -515,6 +516,8 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user sends the following resource share invitation using the Graph API:')]
|
||||
#[When('user :user tries to send the following resource share invitation using the Graph API:')]
|
||||
public function userSendsTheFollowingResourceShareInvitationUsingTheGraphApi(string $user, TableNode $table): void {
|
||||
$rows = $table->getRowsHash();
|
||||
Assert::assertArrayHasKey(
|
||||
@@ -528,7 +531,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends the following resource share invitation to federated user using the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -537,6 +539,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user sends the following resource share invitation to federated user using the Graph API:')]
|
||||
public function userSendsTheFollowingResourceShareInvitationToFederatedUserUsingTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -553,7 +556,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends the following space share invitation using permissions endpoint of the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -562,6 +564,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user sends the following space share invitation using permissions endpoint of the Graph API:')]
|
||||
public function userSendsTheFollowingSpaceShareInvitationUsingPermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -578,7 +581,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" tries to send the following space share invitation to federated user using permissions endpoint of the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -587,6 +589,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user tries to send the following space share invitation to federated user using permissions endpoint of the Graph API:')]
|
||||
public function userSendsTheFollowingSpaceShareInvitationToFederatedUserUsingPermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -603,13 +606,13 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has updated the last resource share with the following properties:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has updated the last resource share with the following properties:')]
|
||||
public function userHasUpdatedTheLastResourceShareWithTheFollowingProperties(string $user, TableNode $table): void {
|
||||
$permissionID = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$response = $this->updateResourceShare(
|
||||
@@ -621,13 +624,13 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user updates the last resource share with the following properties using the Graph API:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user updates the last resource share with the following properties using the Graph API:')]
|
||||
public function userUpdatesTheLastShareWithFollowingPropertiesUsingGraphApi($user, TableNode $table) {
|
||||
$permissionID = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$this->featureContext->setResponse(
|
||||
@@ -640,7 +643,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" updates the space share for (user|group) "([^"]*)" with the following using the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $shareType
|
||||
@@ -649,6 +651,7 @@ class SharingNgContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" updates the space share for (user|group) "([^"]*)" with the following using the Graph API:$/')]
|
||||
public function userUpdatesTheSpaceShareForUserOrGroupWithFollowingUsingGraphApi(
|
||||
string $user,
|
||||
string $shareType,
|
||||
@@ -706,7 +709,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user sends the following share invitation with file-id :fileId using the Graph API:
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileId
|
||||
@@ -716,6 +718,7 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user sends the following share invitation with file-id :fileId using the Graph API:')]
|
||||
public function userSendsTheFollowingShareInvitationWithFileIdUsingTheGraphApi(
|
||||
string $user,
|
||||
string $fileId,
|
||||
@@ -728,8 +731,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" creates the following resource link share using the Graph API:$/
|
||||
* @When /^user "([^"]*)" tries to create the following resource link share using the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -737,13 +738,14 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user creates the following resource link share using the Graph API:')]
|
||||
#[When('user :user tries to create the following resource link share using the Graph API:')]
|
||||
public function userCreatesAPublicLinkShareWithSettings(string $user, TableNode $body): void {
|
||||
$response = $this->createLinkShare($user, $body);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" (?:tries to create|creates) the following space link share using permissions endpoint of the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -751,6 +753,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" (?:tries to create|creates) the following space link share using permissions endpoint of the Graph API:$/')]
|
||||
public function userCreatesTheFollowingSpaceLinkShareUsingPermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $body
|
||||
@@ -759,7 +762,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has created the following resource link share:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -767,6 +769,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has created the following resource link share:')]
|
||||
public function userHasCreatedTheFollowingResourceLinkShare(string $user, TableNode $body): void {
|
||||
$rows = $body->getRowsHash();
|
||||
Assert::assertArrayHasKey(
|
||||
@@ -780,7 +783,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has created the following space link share:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -788,6 +790,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has created the following space link share:')]
|
||||
public function userHasCreatedTheFollowingLinkShare(string $user, TableNode $body): void {
|
||||
$rows = $body->getRowsHash();
|
||||
Assert::assertArrayNotHasKey(
|
||||
@@ -801,7 +804,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has updated the last resource/space link share with
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -809,6 +811,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Given('user :user has updated the last resource/space link share with')]
|
||||
public function userHasUpdatedLastPublicLinkShare(string $user, TableNode $body): void {
|
||||
$response = $this->updateLinkShare(
|
||||
$user,
|
||||
@@ -819,8 +822,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user updates the last public link share using the permissions endpoint of the Graph API:
|
||||
* @When user :user tries to update the last public link share using the permissions endpoint of the Graph API:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -828,6 +829,8 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user updates the last public link share using the permissions endpoint of the Graph API:')]
|
||||
#[When('user :user tries to update the last public link share using the permissions endpoint of the Graph API:')]
|
||||
public function userUpdatesTheLastPublicLinkShareUsingThePermissionsEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $body
|
||||
@@ -921,7 +924,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has set the following password for the last link share:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -929,6 +931,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has set the following password for the last link share:')]
|
||||
public function userHasSetTheFollowingPasswordForTheLastLinkShare(string $user, TableNode $body): void {
|
||||
$response = $this->setLinkSharePassword(
|
||||
$user,
|
||||
@@ -943,8 +946,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user sets the following password for the last link share using the Graph API:
|
||||
* @When user :user tries to set the following password for the last link share using the Graph API:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -952,6 +953,8 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user sets the following password for the last link share using the Graph API:')]
|
||||
#[When('user :user tries to set the following password for the last link share using the Graph API:')]
|
||||
public function userSetsOrUpdatesFollowingPasswordForLastLinkShareUsingTheGraphApi(
|
||||
string $user,
|
||||
TableNode $body
|
||||
@@ -1048,7 +1051,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has removed the access of (user|group) "([^"]*)" from (?:file|folder|resource) "([^"]*)" of space "([^"]*)"$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $recipientType (user|group)
|
||||
@@ -1060,6 +1062,7 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has removed the access of (user|group) "([^"]*)" from (?:file|folder|resource) "([^"]*)" of space "([^"]*)"$/')]
|
||||
public function userHasRemovedAccessOfUserOrGroupFromResourceOfSpace(
|
||||
string $sharer,
|
||||
string $recipientType,
|
||||
@@ -1072,7 +1075,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" removes the access of (user|group) "([^"]*)" from (?:file|folder|resource) "([^"]*)" of space "([^"]*)" using the Graph API$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $recipientType (user|group)
|
||||
@@ -1084,6 +1086,7 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" removes the access of (user|group) "([^"]*)" from (?:file|folder|resource) "([^"]*)" of space "([^"]*)" using the Graph API$/')]
|
||||
public function userRemovesAccessOfUserOrGroupFromResourceOfSpaceUsingGraphAPI(
|
||||
string $sharer,
|
||||
string $recipientType,
|
||||
@@ -1097,7 +1100,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" removes the access of (user|group) "([^"]*)" from space "([^"]*)" using permissions endpoint of the Graph API$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $recipientType (user|group)
|
||||
@@ -1108,6 +1110,7 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" removes the access of (user|group) "([^"]*)" from space "([^"]*)" using permissions endpoint of the Graph API$/')]
|
||||
public function userRemovesAccessOfUserOrGroupFromSpaceUsingPermissionsEndpointOfGraphAPI(
|
||||
string $sharer,
|
||||
string $recipientType,
|
||||
@@ -1120,7 +1123,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" has removed the last link share of (?:file|folder) "([^"]*)" from space "([^"]*)"$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $resource
|
||||
@@ -1130,6 +1132,7 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" has removed the last link share of (?:file|folder) "([^"]*)" from space "([^"]*)"$/')]
|
||||
public function userHasRemovedTheLastLinkShareOfFileOrFolderFromSpace(
|
||||
string $sharer,
|
||||
string $resource,
|
||||
@@ -1140,7 +1143,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" removes the link of (?:file|folder) "([^"]*)" from space "([^"]*)" using the Graph API$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $resource
|
||||
@@ -1150,6 +1152,7 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" removes the link of (?:file|folder) "([^"]*)" from space "([^"]*)" using the Graph API$/')]
|
||||
public function userRemovesSharePermissionOfAResourceInLinkShareUsingGraphAPI(
|
||||
string $sharer,
|
||||
string $resource,
|
||||
@@ -1161,8 +1164,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" removes the access of (user|group) "([^"]*)" from space "([^"]*)" using root endpoint of the Graph API$/
|
||||
* @When /^user "([^"]*)" tries to remove the access of (user|group) "([^"]*)" from space "([^"]*)" using root endpoint of the Graph API$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $recipientType (user|group)
|
||||
@@ -1173,6 +1174,8 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" removes the access of (user|group) "([^"]*)" from space "([^"]*)" using root endpoint of the Graph API$/')]
|
||||
#[When('/^user "([^"]*)" tries to remove the access of (user|group) "([^"]*)" from space "([^"]*)" using root endpoint of the Graph API$/')]
|
||||
public function userRemovesAccessOfUserOrGroupFromSpaceUsingGraphAPI(
|
||||
string $sharer,
|
||||
string $recipientType,
|
||||
@@ -1185,8 +1188,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" removes own access from space "([^"]*)" using root endpoint of the Graph API$/
|
||||
* @When /^user "([^"]*)" tries to remove own access from space "([^"]*)" using root endpoint of the Graph API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
@@ -1195,6 +1196,8 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user removes own access from space :space using root endpoint of the Graph API')]
|
||||
#[When('user :user tries to remove own access from space :space using root endpoint of the Graph API')]
|
||||
public function userRemovesOwnAccessFromSpaceUsingGraphAPI(
|
||||
string $user,
|
||||
string $space
|
||||
@@ -1205,7 +1208,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has removed own access from space "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
@@ -1214,6 +1216,7 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has removed own access from space :space')]
|
||||
public function userHasRemovedOwnAccessFromSpace(
|
||||
string $user,
|
||||
string $space
|
||||
@@ -1223,7 +1226,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" removes the link from space "([^"]*)" using root endpoint of the Graph API$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $space
|
||||
@@ -1232,6 +1234,7 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :sharer removes the link from space :space using root endpoint of the Graph API')]
|
||||
public function userRemovesLinkFromSpaceUsingRootEndpointOfGraphAPI(
|
||||
string $sharer,
|
||||
string $space
|
||||
@@ -1242,7 +1245,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has removed the access of (user|group) "([^"]*)" from space "([^"]*)"$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $recipientType (user|group)
|
||||
@@ -1253,6 +1255,7 @@ class SharingNgContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has removed the access of (user|group) "([^"]*)" from space "([^"]*)"$/')]
|
||||
public function userHasRemovedAccessOfUserOrGroupFromSpace(
|
||||
string $sharer,
|
||||
string $recipientType,
|
||||
@@ -1288,13 +1291,13 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has disabled sync of last shared resource
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Given('user :user has disabled sync of last shared resource')]
|
||||
public function userHasDisabledSyncOfLastSharedResource(string $user): void {
|
||||
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$shareSpaceId = GraphHelper::SHARES_SPACE_ID;
|
||||
@@ -1315,14 +1318,14 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user disables sync of share :share using the Graph API
|
||||
* @When user :user tries to disable sync of share :share using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user disables sync of share :share using the Graph API')]
|
||||
#[When('user :user tries to disable sync of share :share using the Graph API')]
|
||||
public function userDisablesSyncOfShareUsingTheGraphApi(string $user): void {
|
||||
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$shareSpaceId = GraphHelper::SHARES_SPACE_ID;
|
||||
@@ -1342,7 +1345,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user hides the shared resource :sharedResource using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -1350,6 +1352,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user hides the shared resource :sharedResource using the Graph API')]
|
||||
public function userHidesTheSharedResourceUsingTheGraphApi(string $user): void {
|
||||
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$response = $this->hideOrUnhideSharedResource($user, $shareItemId);
|
||||
@@ -1357,7 +1360,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has hidden the share :sharedResource
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -1365,6 +1367,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has hidden the share :sharedResource')]
|
||||
public function userHasHiddenTheShare(string $user): void {
|
||||
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$response = $this->hideOrUnhideSharedResource($user, $shareItemId);
|
||||
@@ -1372,7 +1375,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user unhides the shared resource :sharedResource using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -1380,6 +1382,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user unhides the shared resource :sharedResource using the Graph API')]
|
||||
public function userUnhidesTheSharedResourceUsingTheGraphApi(string $user): void {
|
||||
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$response = $this->hideOrUnhideSharedResource($user, $shareItemId, false);
|
||||
@@ -1387,7 +1390,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user enables sync of share :share offered by :offeredBy from :space space using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $share
|
||||
@@ -1397,6 +1399,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user enables sync of share :share offered by :offeredBy from :space space using the Graph API')]
|
||||
public function userEnablesSyncOfShareUsingTheGraphApi(
|
||||
string $user,
|
||||
string $share,
|
||||
@@ -1420,15 +1423,14 @@ class SharingNgContext implements Context {
|
||||
/**
|
||||
* step definition for enabling sync for items for non-existing group|user|space sharer
|
||||
*
|
||||
* @When user :user tries to enable share sync of a resource :resource using the Graph API
|
||||
* @When user :user enables share sync of a resource :resource using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[When('user :user tries to enable share sync of a resource :resource using the Graph API')]
|
||||
#[When('user :user enables share sync of a resource :resource using the Graph API')]
|
||||
public function userTriesToEnableShareSyncOfResourceUsingTheGraphApi(string $user, string $resource): void {
|
||||
$shareSpaceId = GraphHelper::SHARES_SPACE_ID;
|
||||
$itemId = ($resource === 'nonexistent') ? WebDavHelper::generateUUIDv4() : $resource;
|
||||
@@ -1445,7 +1447,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to disable share sync of a resource :resource using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
@@ -1453,6 +1454,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[When('user :user tries to disable share sync of a resource :resource using the Graph API')]
|
||||
public function userTriesToDisableShareSyncOfResourceUsingTheGraphApi(string $user, string $resource): void {
|
||||
$shareSpaceId = GraphHelper::SHARES_SPACE_ID;
|
||||
$shareID = ($resource === 'nonexistent') ? WebDavHelper::generateUUIDv4() : $resource;
|
||||
@@ -1528,7 +1530,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" has a share "([^"]*)" synced$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
@@ -1536,12 +1537,12 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Then('user :user has a share :resource synced')]
|
||||
public function userHasShareSynced(string $user, string $resource): void {
|
||||
$this->waitAndCheckShareSyncStatus($user, $resource, "enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should have sync (enabled|disabled) for share "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $status
|
||||
@@ -1550,12 +1551,12 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Then('/^user "([^"]*)" should have sync (enabled|disabled) for share "([^"]*)"$/')]
|
||||
public function userShouldHaveSyncEnabledOrDisabledForShare(string $user, string $status, string $resource): void {
|
||||
$this->waitAndCheckShareSyncStatus($user, $resource, $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should be able to send the following resource share invitation with all allowed permission roles
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -1564,6 +1565,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Then('user :user should be able to send the following resource share invitation with all allowed permission roles')]
|
||||
public function userShouldBeAbleToSendShareTheFollowingInvitationWithAllAllowedPermissionRoles(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -1615,7 +1617,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" (?:tries to list|lists) the permissions of space "([^"]*)" using root endpoint of the Graph API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
@@ -1625,12 +1626,12 @@ class SharingNgContext implements Context {
|
||||
* @throws GuzzleException
|
||||
*
|
||||
*/
|
||||
#[When('/^user "([^"]*)" (?:tries to list|lists) the permissions of space "([^"]*)" using root endpoint of the Graph API$/')]
|
||||
public function userListsThePermissionsOfDriveUsingRootEndPointOFTheGraphApi(string $user, string $space): void {
|
||||
$this->featureContext->setResponse($this->getDrivePermissionsList($user, $space));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" (?:tries to send|sends) the following space share invitation using root endpoint of the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -1638,6 +1639,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" (?:tries to send|sends) the following space share invitation using root endpoint of the Graph API:$/')]
|
||||
public function userSendsTheFollowingShareInvitationUsingRootEndPointTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -1647,7 +1649,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" tries to send the following space share invitation to federated user using root endpoint of the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -1655,6 +1656,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user tries to send the following space share invitation to federated user using root endpoint of the Graph API:')]
|
||||
public function userSendsTheFollowingShareInvitationToFederatedUserUsingRootEndPointTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -1664,7 +1666,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user updates the last drive share with the following using root endpoint of the Graph API:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -1672,6 +1673,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user updates the last drive share with the following using root endpoint of the Graph API:')]
|
||||
public function userUpdatesTheLastDriveShareWithTheFollowingUsingRootEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -1705,7 +1707,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" (?:tries to create|creates) the following space link share using root endpoint of the Graph API:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -1713,6 +1714,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('/^user "([^"]*)" (?:tries to create|creates) the following space link share using root endpoint of the Graph API:$/')]
|
||||
public function userCreatesTheFollowingSpaceLinkShareUsingRootEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
TableNode $body
|
||||
@@ -1729,7 +1731,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user sets the following password for the last space link share using root endpoint of the Graph API:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -1737,6 +1738,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user sets the following password for the last space link share using root endpoint of the Graph API:')]
|
||||
public function userSetsTheFollowingPasswordForTheLastSpaceLinkShareUsingRootEndpointOfTheGraphAPI(
|
||||
string $user,
|
||||
TableNode $body
|
||||
@@ -1769,7 +1771,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to remove the link from space :space owned by :owner using root endpoint of the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
@@ -1778,6 +1779,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user tries to remove the link from space :space owned by :owner using root endpoint of the Graph API')]
|
||||
public function userTriesToRemoveShareLinkOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
string $space,
|
||||
@@ -1798,7 +1800,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should not have any :shareType permissions on space :space
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $shareType
|
||||
@@ -1807,6 +1808,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Then('user :user should not have any :shareType permissions on space :space')]
|
||||
public function userShouldNotHaveAnyPermissionsOnSpace(string $user, string $shareType, string $space): void {
|
||||
$response = $this->getDrivePermissionsList($user, $space);
|
||||
$responseBody = $this->featureContext->getJsonDecodedResponse($response);
|
||||
@@ -1833,7 +1835,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should be able to send the following space share invitation with all allowed permission roles using root endpoint of the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -1842,6 +1843,7 @@ class SharingNgContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @codingStandardsIgnoreStart
|
||||
*/
|
||||
#[Then('user :user should be able to send the following space share invitation with all allowed permission roles using root endpoint of the Graph API')]
|
||||
public function userShouldBeAbleToSendTheFollowingSpaceShareInvitationWithAllAllowedPermissionRolesUsingRootEndpointOFTheGraphApi(
|
||||
// @codingStandardsIgnoreEnd
|
||||
string $user,
|
||||
@@ -1893,7 +1895,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to list the permissions of space :space owned by :spaceOwner using root endpoint of the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
@@ -1902,6 +1903,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user tries to list the permissions of space :space owned by :spaceOwner using root endpoint of the Graph API')]
|
||||
public function userTriesToListThePermissionsOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(
|
||||
string $user,
|
||||
string $space,
|
||||
@@ -1911,13 +1913,13 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user removes the last link share of space :space using permissions endpoint of the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user removes the last link share of space :space using permissions endpoint of the Graph API')]
|
||||
public function userRemovesTheLastLinkShareOfSpaceUsingPermissionsEndpointOfGraphApi(
|
||||
string $user,
|
||||
string $space
|
||||
@@ -2010,7 +2012,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" (should|should not) have a share "([^"]*)" shared by user "([^"]*)" from space "([^"]*)"$/
|
||||
*
|
||||
* @param string $sharee
|
||||
* @param string $shouldOrNot
|
||||
@@ -2020,6 +2021,7 @@ class SharingNgContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('/^user "([^"]*)" (should|should not) have a share "([^"]*)" shared by user "([^"]*)" from space "([^"]*)"$/')]
|
||||
public function userShouldHaveShareSharedByUserFromSpace(
|
||||
string $sharee,
|
||||
string $shouldOrNot,
|
||||
@@ -2031,7 +2033,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" (should|should not) have a federated share "([^"]*)" shared by user "([^"]*)" from space "([^"]*)"$/
|
||||
*
|
||||
* @param string $sharee
|
||||
* @param string $shouldOrNot
|
||||
@@ -2041,6 +2042,7 @@ class SharingNgContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('/^user "([^"]*)" (should|should not) have a federated share "([^"]*)" shared by user "([^"]*)" from space "([^"]*)"$/')]
|
||||
public function userShouldOrShouldNotHaveFederatedShareSharedByUserFromSpace(
|
||||
string $sharee,
|
||||
string $shouldOrNot,
|
||||
@@ -2052,7 +2054,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has shared the following (?:files|folders) from space "([^"]*)" with user "([^"]*)" and role "([^"]*)":$/
|
||||
*
|
||||
* @param string $sharer
|
||||
* @param string $space
|
||||
@@ -2062,6 +2063,7 @@ class SharingNgContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has shared the following (?:files|folders) from space "([^"]*)" with user "([^"]*)" and role "([^"]*)":$/')]
|
||||
public function userHasSharedTheFollowingFilesFromSpaceWithUserAndRole(
|
||||
string $sharer,
|
||||
string $space,
|
||||
@@ -2086,12 +2088,12 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the json response should contain the following shares:
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('the json response should contain the following shares:')]
|
||||
public function theJsonResponseShouldContainTheFollowingShares(TableNode $table): void {
|
||||
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||
|
||||
@@ -2115,7 +2117,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the allowed roles for federated user of (folder|file) "([^"]*)" from the space "([^"]*)" using the Graph API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
@@ -2125,6 +2126,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets the allowed roles for federated user of (folder|file) "([^"]*)" from the space "([^"]*)" using the Graph API$/')]
|
||||
public function userGetsFederatedPermissionsListForFileOfTheSpaceUsingTheGraphApi(
|
||||
string $user,
|
||||
string $fileOrFolder,
|
||||
@@ -2132,7 +2134,7 @@ class SharingNgContext implements Context {
|
||||
string $space
|
||||
): void {
|
||||
$query = '$filter=@libre.graph.permissions.roles.allowedValues'
|
||||
. '/rolePermissions/any(p:contains(p/condition,+\'@Subject.UserType=="Federated"\'))'
|
||||
. ' /rolePermissions/any(p:contains(p/condition,+\'@Subject.UserType=="Federated"\'))'
|
||||
. '&$select=@libre.graph.permissions.roles.allowedValues';
|
||||
$this->featureContext->setResponse(
|
||||
$this->getPermissionsList($user, $fileOrFolder, $space, $resource, $query)
|
||||
@@ -2140,7 +2142,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the permittion list of (folder|file) "([^"]*)" from the space "([^"]*)" using the Graph API with query "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
@@ -2151,6 +2152,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets the permittion list of (folder|file) "([^"]*)" from the space "([^"]*)" using the Graph API with query "([^"]*)"$/')]
|
||||
public function userGetsPermissionsListWithQueryForFileOfTheSpaceUsingTheGraphApi(
|
||||
string $user,
|
||||
string $fileOrFolder,
|
||||
@@ -2164,7 +2166,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the drive permittion list of the space "([^"]*)" using the Graph API with query "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $space
|
||||
@@ -2173,6 +2174,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user gets the drive permittion list of the space :space using the Graph API with query :query')]
|
||||
public function userGetsDrivePermissionsListWithQueryUsingTheGraphApi(
|
||||
string $user,
|
||||
string $space,
|
||||
@@ -2182,7 +2184,6 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the JSON data of the response should (not |)contain the following keys:$/
|
||||
*
|
||||
* @param string|null $shouldOrNot (not| )
|
||||
* @param TableNode $table
|
||||
@@ -2190,6 +2191,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the JSON data of the response should (not |)contain the following keys:$/')]
|
||||
public function theJsonDataResponseShouldOrNotContainData(string $shouldOrNot, TableNode $table): void {
|
||||
$response = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse());
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,9 @@ use GuzzleHttp\Exception\GuzzleException;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -45,7 +48,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has uploaded a file from "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $source
|
||||
@@ -57,6 +59,7 @@ class SpacesTUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has uploaded a file from :source to :destination via TUS inside of the space :spaceName using the WebDAV API')]
|
||||
public function userHasUploadedFileViaTusInSpace(
|
||||
string $user,
|
||||
string $source,
|
||||
@@ -69,7 +72,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" uploads a file from "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $source
|
||||
@@ -80,6 +82,7 @@ class SpacesTUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user uploads a file from :source to :destination via TUS inside of the space :spaceName using the WebDAV API')]
|
||||
public function userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi(
|
||||
string $user,
|
||||
string $source,
|
||||
@@ -92,7 +95,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has created a new TUS resource in the space :spaceName with the following headers:
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
@@ -103,6 +105,7 @@ class SpacesTUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has created a new TUS resource in the space :spaceName with the following headers:')]
|
||||
public function userHasCreatedANewTusResourceForTheSpaceUsingTheWebdavApiWithTheseHeaders(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
@@ -114,7 +117,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user creates a new TUS resource for the space :spaceName with content :content using the WebDAV API with these headers:
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
@@ -126,6 +128,7 @@ class SpacesTUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user creates a new TUS resource for the space :spaceName with content :content using the WebDAV API with these headers:')]
|
||||
public function userCreatesANewTusResourceForTheSpaceUsingTheWebdavApiWithTheseHeaders(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
@@ -166,7 +169,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" uploads a file with content "([^"]*)" to "([^"]*)" inside federated share "([^"]*)" via TUS using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $content
|
||||
@@ -176,6 +178,7 @@ class SpacesTUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[When('user :user uploads a file with content :content to :file inside federated share :destination via TUS using the WebDAV API')]
|
||||
public function userUploadsAFileWithContentToInsideFederatedShareViaTusUsingTheWebdavApi(
|
||||
string $user,
|
||||
string $content,
|
||||
@@ -196,7 +199,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" uploads a file with content "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $content
|
||||
@@ -206,6 +208,7 @@ class SpacesTUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[When('user :user uploads a file with content :content to :resource via TUS inside of the space :spaceName using the WebDAV API')]
|
||||
public function userUploadsAFileWithContentToViaTusInsideOfTheSpaceUsingTheWebdavApi(
|
||||
string $user,
|
||||
string $content,
|
||||
@@ -216,7 +219,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has uploaded a file with content "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $content
|
||||
@@ -226,6 +228,7 @@ class SpacesTUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Given('user :user has uploaded a file with content :content to :resource via TUS inside of the space :spaceName')]
|
||||
public function userHasUploadedAFileWithContentToViaTusInsideOfTheSpace(
|
||||
string $user,
|
||||
string $content,
|
||||
@@ -236,7 +239,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" uploads a file "([^"]*)" to "([^"]*)" with mtime "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $source
|
||||
@@ -249,6 +251,7 @@ class SpacesTUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user uploads a file :source to :destination with mtime :mtime via TUS inside of the space :spaceName using the WebDAV API')]
|
||||
public function userUploadsAFileToWithMtimeViaTusInsideOfTheSpaceUsingTheWebdavApi(
|
||||
string $user,
|
||||
string $source,
|
||||
@@ -289,7 +292,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has uploaded file with checksum "([^"]*)" to the last created TUS Location with offset "([^"]*)" and content "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $checksum
|
||||
@@ -301,6 +303,7 @@ class SpacesTUSContext implements Context {
|
||||
* @throws Exception|GuzzleException
|
||||
* @codingStandardsIgnoreStart
|
||||
*/
|
||||
#[Given('user :user has uploaded file with checksum :checksum to the last created TUS Location with offset :offset and content :content via TUS inside of the space :spaceName using the WebDAV API')]
|
||||
public function userHasUploadedFileWithChecksumToTheLastCreatedTusLocationWithOffsetAndContentViaTusInsideOfTheSpaceUsingTheWebdavApi(
|
||||
// @codingStandardsIgnoreEnd
|
||||
string $user,
|
||||
@@ -315,7 +318,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" uploads file with checksum "([^"]*)" to the last created TUS Location with offset "([^"]*)" and content "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $checksum
|
||||
@@ -327,6 +329,7 @@ class SpacesTUSContext implements Context {
|
||||
* @throws Exception|GuzzleException
|
||||
* @codingStandardsIgnoreStart
|
||||
*/
|
||||
#[When('user :user uploads file with checksum :checksum to the last created TUS Location with offset :offset and content :content via TUS inside of the space :spaceName using the WebDAV API')]
|
||||
public function userUploadsFileWithChecksumToTheLastCreatedTusLocationWithOffsetAndContentViaTusInsideOfTheSpaceUsingTheWebdavApi(
|
||||
// @codingStandardsIgnoreEnd
|
||||
string $user,
|
||||
@@ -341,7 +344,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends a chunk to the last created TUS Location with offset "([^"]*)" and data "([^"]*)" with checksum "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $offset
|
||||
@@ -353,6 +355,7 @@ class SpacesTUSContext implements Context {
|
||||
* @throws Exception|GuzzleException
|
||||
* @codingStandardsIgnoreStart
|
||||
*/
|
||||
#[When('user :user sends a chunk to the last created TUS Location with offset :offset and data :data with checksum :checksum via TUS inside of the space :spaceName using the WebDAV API')]
|
||||
public function userSendsAChunkToTheLastCreatedTusLocationWithOffsetAndDataWithChecksumViaTusInsideOfTheSpaceUsingTheWebdavApi(
|
||||
// @codingStandardsIgnoreEnd
|
||||
string $user,
|
||||
@@ -367,7 +370,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends a chunk to the last created TUS Location with data "([^"]*)" with the following headers:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $data
|
||||
@@ -376,6 +378,7 @@ class SpacesTUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[When('user :user sends a chunk to the last created TUS Location with data :data with the following headers:')]
|
||||
public function userSendsAChunkToTheLastCreatedTusLocationWithDataInsideOfTheSpaceWithHeaders(
|
||||
string $user,
|
||||
string $data,
|
||||
@@ -395,7 +398,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" overwrites recently shared file with offset "([^"]*)" and data "([^"]*)" with checksum "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API with these headers:$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $offset
|
||||
@@ -408,6 +410,7 @@ class SpacesTUSContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @codingStandardsIgnoreStart
|
||||
*/
|
||||
#[When('user :user overwrites recently shared file with offset :offset and data :data with checksum :checksum via TUS inside of the space :spaceName using the WebDAV API with these headers:')]
|
||||
public function userOverwritesRecentlySharedFileWithOffsetAndDataWithChecksumViaTusInsideOfTheSpaceUsingTheWebdavApiWithTheseHeaders(
|
||||
// @codingStandardsIgnoreEnd
|
||||
string $user,
|
||||
@@ -426,7 +429,6 @@ class SpacesTUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as "([^"]*)" the mtime of the file "([^"]*)" in space "([^"]*)" should be "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
@@ -436,6 +438,7 @@ class SpacesTUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Then('as :user the mtime of the file :resource in space :spaceName should be :mtime')]
|
||||
public function theMtimeOfTheFileInSpaceShouldBe(
|
||||
string $user,
|
||||
string $resource,
|
||||
|
||||
@@ -33,6 +33,8 @@ use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use TestHelpers\UploadHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -130,7 +132,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user creates a new TUS resource on the WebDAV API with these headers:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $headers
|
||||
@@ -141,13 +142,13 @@ class TUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user creates a new TUS resource on the WebDAV API with these headers:')]
|
||||
public function userCreateNewTUSResourceWithHeaders(string $user, TableNode $headers, string $content = ''): void {
|
||||
$response = $this->createNewTUSResourceWithHeaders($user, $headers, $content);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has created a new TUS resource on the WebDAV API with these headers:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $headers Tus-Resumable: 1.0.0 header is added automatically
|
||||
@@ -157,6 +158,7 @@ class TUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has created a new TUS resource on the WebDAV API with these headers:')]
|
||||
public function userHasCreatedNewTUSResourceWithHeaders(string $user, TableNode $headers): void {
|
||||
$response = $this->createNewTUSResource($user, $headers);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response);
|
||||
@@ -218,7 +220,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user sends a chunk to the last created TUS Location with offset :offset and data :data with retry on offset mismatch using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $offset
|
||||
@@ -229,6 +230,7 @@ class TUSContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('user :user sends a chunk to the last created TUS Location with offset :offset and data :data with retry on offset mismatch using the WebDAV API')]
|
||||
public function userSendsAChunkToTUSLocationWithOffsetAndDataWithRetryOnOffsetMismatch(
|
||||
string $user,
|
||||
string $offset,
|
||||
@@ -256,7 +258,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user sends a chunk to the last created TUS Location with offset :offset and data :data using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $offset
|
||||
@@ -267,6 +268,7 @@ class TUSContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
#[When('user :user sends a chunk to the last created TUS Location with offset :offset and data :data using the WebDAV API')]
|
||||
public function userSendsAChunkToTUSLocationWithOffsetAndData(string $user, string $offset, string $data): void {
|
||||
$resourceLocation = $this->getLastTusResourceLocation();
|
||||
$response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data);
|
||||
@@ -274,7 +276,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user uploads file :source to :destination using the TUS protocol on the WebDAV API
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string $source
|
||||
@@ -294,6 +295,7 @@ class TUSContext implements Context {
|
||||
* @throws ReflectionException
|
||||
* @throws TusException
|
||||
*/
|
||||
#[When('user :user uploads file :source to :destination using the TUS protocol on the WebDAV API')]
|
||||
public function userUploadsUsingTusAFileTo(
|
||||
?string $user,
|
||||
string $source,
|
||||
@@ -384,7 +386,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user uploads file with content :content to :destination using the TUS protocol on the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $content
|
||||
@@ -394,6 +395,7 @@ class TUSContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user uploads file with content :content to :destination using the TUS protocol on the WebDAV API')]
|
||||
public function userUploadsAFileWithContentToUsingTus(
|
||||
string $user,
|
||||
string $content,
|
||||
@@ -414,7 +416,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user uploads file with content :content in :noOfChunks chunks to :destination using the TUS protocol on the WebDAV API
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string $content
|
||||
@@ -430,6 +431,7 @@ class TUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user uploads file with content :content in :noOfChunks chunks to :destination using the TUS protocol on the WebDAV API')]
|
||||
public function userUploadsAFileWithContentInChunksUsingTus(
|
||||
?string $user,
|
||||
string $content,
|
||||
@@ -450,7 +452,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has uploaded file :source to :destination with mtime :mtime using the TUS protocol
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $source
|
||||
@@ -461,6 +462,7 @@ class TUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has uploaded file :source to :destination with mtime :mtime using the TUS protocol')]
|
||||
public function userHasUploadedFileWithMtimeUsingTUS(
|
||||
string $user,
|
||||
string $source,
|
||||
@@ -481,7 +483,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user uploads file :source to :destination with mtime :mtime using the TUS protocol on the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $source
|
||||
@@ -492,6 +493,7 @@ class TUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user uploads file :source to :destination with mtime :mtime using the TUS protocol on the WebDAV API')]
|
||||
public function userUploadsFileWithContentToWithMtimeUsingTUS(
|
||||
string $user,
|
||||
string $source,
|
||||
@@ -551,7 +553,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user creates a new TUS resource with content :content on the WebDAV API with these headers:
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $content
|
||||
@@ -561,6 +562,7 @@ class TUSContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user creates a new TUS resource with content :content on the WebDAV API with these headers:')]
|
||||
public function userCreatesWithUpload(
|
||||
string $user,
|
||||
string $content,
|
||||
@@ -571,7 +573,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user creates file :source and uploads content :content in the same request using the TUS protocol on the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $source
|
||||
@@ -580,6 +581,7 @@ class TUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user creates file :source and uploads content :content in the same request using the TUS protocol on the WebDAV API')]
|
||||
public function userUploadsWithCreatesWithUpload(
|
||||
string $user,
|
||||
string $source,
|
||||
@@ -600,7 +602,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user uploads file with checksum :checksum to the last created TUS Location with offset :offset and content :content using the TUS protocol on the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $checksum
|
||||
@@ -610,6 +611,7 @@ class TUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user uploads file with checksum :checksum to the last created TUS Location with offset :offset and content :content using the TUS protocol on the WebDAV API')]
|
||||
public function userUploadsFileWithChecksum(
|
||||
string $user,
|
||||
string $checksum,
|
||||
@@ -622,8 +624,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user uploads content :content with checksum :checksum and offset :offset to the index :locationIndex location of file :filename using the TUS protocol
|
||||
* @When user :user tries to upload content :content with checksum :checksum and offset :offset to the index :locationIndex location of file :filename using the TUS protocol
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $content
|
||||
@@ -635,6 +635,8 @@ class TUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user uploads content :content with checksum :checksum and offset :offset to the index :locationIndex location of file :filename using the TUS protocol')]
|
||||
#[When('user :user tries to upload content :content with checksum :checksum and offset :offset to the index :locationIndex location of file :filename using the TUS protocol')]
|
||||
public function userUploadsContentWithChecksumAndOffsetToIndexLocationUsingTUSProtocol(
|
||||
string $user,
|
||||
string $content,
|
||||
@@ -650,7 +652,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has uploaded file with checksum :checksum to the last created TUS Location with offset :offset and content :content using the TUS protocol on the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $checksum
|
||||
@@ -660,6 +661,7 @@ class TUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has uploaded file with checksum :checksum to the last created TUS Location with offset :offset and content :content using the TUS protocol on the WebDAV API')]
|
||||
public function userHasUploadedFileWithChecksum(
|
||||
string $user,
|
||||
string $checksum,
|
||||
@@ -672,7 +674,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user sends a chunk to the last created TUS Location with offset :offset and data :data with checksum :checksum using the TUS protocol on the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $offset
|
||||
@@ -682,6 +683,7 @@ class TUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user sends a chunk to the last created TUS Location with offset :offset and data :data with checksum :checksum using the TUS protocol on the WebDAV API')]
|
||||
public function userUploadsChunkFileWithChecksum(
|
||||
string $user,
|
||||
string $offset,
|
||||
@@ -694,7 +696,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has uploaded a chunk to the last created TUS Location with offset :offset and data :data with checksum :checksum using the TUS protocol on the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $offset
|
||||
@@ -704,6 +705,7 @@ class TUSContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has uploaded a chunk to the last created TUS Location with offset :offset and data :data with checksum :checksum using the TUS protocol on the WebDAV API')]
|
||||
public function userHasUploadedChunkFileWithChecksum(
|
||||
string $user,
|
||||
string $offset,
|
||||
@@ -716,8 +718,6 @@ class TUSContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user overwrites recently shared file with offset :offset and data :data with checksum :checksum using the TUS protocol on the WebDAV API with these headers:
|
||||
* @When user :user overwrites existing file with offset :offset and data :data with checksum :checksum using the TUS protocol on the WebDAV API with these headers:
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $offset
|
||||
@@ -730,6 +730,8 @@ class TUSContext implements Context {
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user overwrites recently shared file with offset :offset and data :data with checksum :checksum using the TUS protocol on the WebDAV API with these headers:')]
|
||||
#[When('user :user overwrites existing file with offset :offset and data :data with checksum :checksum using the TUS protocol on the WebDAV API with these headers:')]
|
||||
public function userOverwritesFileWithChecksum(
|
||||
string $user,
|
||||
string $offset,
|
||||
|
||||
@@ -26,6 +26,9 @@ use PHPUnit\Framework\Assert;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use TestHelpers\GraphHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -92,7 +95,6 @@ class TagContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" creates the following tags for (folder|file) "([^"]*)" of space "([^"]*)":$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
@@ -103,6 +105,7 @@ class TagContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" creates the following tags for (folder|file) "([^"]*)" of space "([^"]*)":$/')]
|
||||
public function theUserCreatesFollowingTags(
|
||||
string $user,
|
||||
string $fileOrFolder,
|
||||
@@ -115,7 +118,6 @@ class TagContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has created the following tags for (folder|file)\s?"([^"]*)" of the space "([^"]*)":$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
@@ -126,6 +128,7 @@ class TagContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has created the following tags for (folder|file)\\s?"([^"]*)" of the space "([^"]*)":$/')]
|
||||
public function theUserHasCreatedFollowingTags(
|
||||
string $user,
|
||||
string $fileOrFolder,
|
||||
@@ -138,7 +141,6 @@ class TagContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has tagged the following (folders|files) of the space "([^"]*)":$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $filesOrFolders (files|folders)
|
||||
@@ -148,6 +150,7 @@ class TagContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has tagged the following (folders|files) of the space "([^"]*)":$/')]
|
||||
public function userHasCreatedTheFollowingTagsForFilesOfTheSpace(
|
||||
string $user,
|
||||
string $filesOrFolders,
|
||||
@@ -164,13 +167,13 @@ class TagContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user lists all available tag(s) via the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user lists all available tag(s) via the Graph API')]
|
||||
public function theUserGetsAllAvailableTags(string $user): void {
|
||||
// Note: after creating or deleting tags, in some cases tags do not appear or disappear immediately,
|
||||
// So wait is necessary before listing tags
|
||||
@@ -186,7 +189,6 @@ class TagContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the response should (not|)\s?contain following tag(s):$/
|
||||
*
|
||||
* @param string $shouldOrNot (not|)
|
||||
* @param TableNode $table
|
||||
@@ -194,6 +196,7 @@ class TagContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the response should (not|)\\s?contain following tag(s):$/')]
|
||||
public function theFollowingTagsShouldExistForUser(string $shouldOrNot, TableNode $table): void {
|
||||
$rows = $table->getRows();
|
||||
foreach ($rows as $row) {
|
||||
@@ -255,7 +258,6 @@ class TagContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" removes the following tags for (folder|file) "([^"]*)" of space "([^"]*)":$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
@@ -266,6 +268,7 @@ class TagContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" removes the following tags for (folder|file) "([^"]*)" of space "([^"]*)":$/')]
|
||||
public function userRemovesTagsFromResourceOfTheSpace(
|
||||
string $user,
|
||||
string $fileOrFolder,
|
||||
@@ -284,7 +287,6 @@ class TagContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has removed the following tags for (folder|file) "([^"]*)" of space "([^"]*)":$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileOrFolder (file|folder)
|
||||
@@ -295,6 +297,7 @@ class TagContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has removed the following tags for (folder|file) "([^"]*)" of space "([^"]*)":$/')]
|
||||
public function userHAsRemovedTheFollowingTagsForFileOfSpace(
|
||||
string $user,
|
||||
string $fileOrFolder,
|
||||
|
||||
@@ -28,6 +28,9 @@ use Psr\Http\Message\ResponseInterface;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -61,12 +64,12 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user empties the trashbin using the trashbin API
|
||||
*
|
||||
* @param string $user user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user empties the trashbin using the trashbin API')]
|
||||
public function userEmptiesTrashbin(string $user): void {
|
||||
$this->featureContext->setResponse($this->emptyTrashbin($user));
|
||||
}
|
||||
@@ -323,7 +326,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user lists the resources in the trashbin with depth :depth using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $depth
|
||||
@@ -331,18 +333,19 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user lists the resources in the trashbin with depth :depth using the WebDAV API')]
|
||||
public function userGetsFilesInTheTrashbinWithDepthUsingTheWebdavApi(string $user, string $depth): void {
|
||||
$this->listTopOfTrashbinFolder($user, $depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the trashbin DAV response should not contain these nodes
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the trashbin DAV response should not contain these nodes')]
|
||||
public function theTrashbinDavResponseShouldNotContainTheseNodes(TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['name']);
|
||||
$files = $this->getTrashbinContentFromResponseXml(
|
||||
@@ -360,13 +363,13 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the trashbin DAV response should contain these nodes
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the trashbin DAV response should contain these nodes')]
|
||||
public function theTrashbinDavResponseShouldContainTheseNodes(TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['name']);
|
||||
|
||||
@@ -428,7 +431,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :asUser tries to list the trashbin content for user :user
|
||||
*
|
||||
* @param string $asUser
|
||||
* @param string $user
|
||||
@@ -436,6 +438,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :asUser tries to list the trashbin content for user :user')]
|
||||
public function userTriesToListTheTrashbinContentForUser(string $asUser, string $user) {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$asUser = $this->featureContext->getActualUsername($asUser);
|
||||
@@ -444,7 +447,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :asUser tries to list the trashbin content for user :user using password :password
|
||||
*
|
||||
* @param string $asUser
|
||||
* @param string $user
|
||||
@@ -453,6 +455,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :asUser tries to list the trashbin content for user :user using password :password')]
|
||||
public function userTriesToListTheTrashbinContentForUserUsingPassword(
|
||||
string $asUser,
|
||||
string $user,
|
||||
@@ -463,13 +466,13 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the last webdav response should not contain the following elements
|
||||
*
|
||||
* @param TableNode $elements
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the last webdav response should not contain the following elements')]
|
||||
public function theLastWebdavResponseShouldNotContainFollowingElements(TableNode $elements): void {
|
||||
$files = $this->getTrashbinContentFromResponseXml(
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse())
|
||||
@@ -495,7 +498,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to delete the file with original path :path from the trashbin of user :ofUser using the trashbin API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -504,13 +506,13 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user tries to delete the file with original path :path from the trashbin of user :ofUser using the trashbin API')]
|
||||
public function userTriesToDeleteFromTrashbinOfUser(string $user, string $path, string $ofUser): void {
|
||||
$response = $this->deleteItemFromTrashbin($user, $path, $ofUser);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to delete the file with original path :path from the trashbin of user :ofUser using the password :password and the trashbin API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -521,6 +523,7 @@ class TrashbinContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user tries to delete the file with original path :path from the trashbin of user :ofUser using the password :password and the trashbin API')]
|
||||
public function userTriesToDeleteFromTrashbinOfUserUsingPassword(
|
||||
string $user,
|
||||
string $path,
|
||||
@@ -532,7 +535,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :asUser tries to restore the file with original path :path from the trashbin of user :user using the trashbin API
|
||||
*
|
||||
* @param string|null $asUser
|
||||
* @param string|null $path
|
||||
@@ -542,6 +544,7 @@ class TrashbinContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :asUser tries to restore the file with original path :path from the trashbin of user :user using the trashbin API')]
|
||||
public function userTriesToRestoreFromTrashbinOfUser(?string $asUser, ?string $path, ?string $user): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$asUser = $this->featureContext->getActualUsername($asUser);
|
||||
@@ -550,7 +553,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :asUser tries to restore the file with original path :path from the trashbin of user :user using the password :password and the trashbin API
|
||||
*
|
||||
* @param string|null $asUser
|
||||
* @param string|null $path
|
||||
@@ -561,6 +563,7 @@ class TrashbinContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :asUser tries to restore the file with original path :path from the trashbin of user :user using the password :password and the trashbin API')]
|
||||
public function userTriesToRestoreFromTrashbinOfUserUsingPassword(
|
||||
?string $asUser,
|
||||
?string $path,
|
||||
@@ -590,13 +593,13 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" tries to delete the (?:file|folder|entry) with original path "([^"]*)" from the trashbin using the trashbin API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $originalPath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" tries to delete the (?:file|folder|entry) with original path "([^"]*)" from the trashbin using the trashbin API$/')]
|
||||
public function userTriesToDeleteFileWithOriginalPathFromTrashbinUsingTrashbinAPI(
|
||||
string $user,
|
||||
string $originalPath
|
||||
@@ -657,7 +660,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" deletes the (?:file|folder|entry) with original path "([^"]*)" from the trashbin using the trashbin API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $originalPath
|
||||
@@ -665,6 +667,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" deletes the (?:file|folder|entry) with original path "([^"]*)" from the trashbin using the trashbin API$/')]
|
||||
public function deleteFileFromTrashbin(string $user, string $originalPath): void {
|
||||
$response = $this->deleteItemFromTrashbin($user, $originalPath);
|
||||
$this->featureContext->setResponse($response);
|
||||
@@ -672,7 +675,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has deleted the (?:file|folder|entry) with original path "([^"]*)" from the trashbin$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $originalPath
|
||||
@@ -680,13 +682,13 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has deleted the (?:file|folder|entry) with original path "([^"]*)" from the trashbin$/')]
|
||||
public function userHasDeletedTheFolderWithOriginalPathFromTheTrashbin(string $user, string $originalPath): void {
|
||||
$response = $this->deleteItemFromTrashbin($user, $originalPath);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, '', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" deletes the following (?:files|folders|entries) with original path from the trashbin$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -694,6 +696,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" deletes the following (?:files|folders|entries) with original path from the trashbin$/')]
|
||||
public function deleteFollowingFilesFromTrashbin(string $user, TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ["path"]);
|
||||
$paths = $table->getHash();
|
||||
@@ -706,7 +709,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as "([^"]*)" (?:file|folder|entry) "([^"]*)" should exist in the trashbin$/
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string|null $path
|
||||
@@ -715,6 +717,7 @@ class TrashbinContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^as "([^"]*)" (?:file|folder|entry) "([^"]*)" should exist in the trashbin$/')]
|
||||
public function asFileOrFolderExistsInTrash(?string $user, ?string $path): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$path = \trim($path, '/');
|
||||
@@ -883,7 +886,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user restores the folder/file with original path :originalPath without specifying the destination using the trashbin API
|
||||
*
|
||||
* @param $user string
|
||||
* @param $originalPath string
|
||||
@@ -891,6 +893,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user restores the folder/file with original path :originalPath without specifying the destination using the trashbin API')]
|
||||
public function userRestoresResourceWithOriginalPathWithoutSpecifyingDestinationUsingTrashbinApi(
|
||||
string $user,
|
||||
string $originalPath
|
||||
@@ -917,7 +920,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" restores the (?:file|folder|entry) with original path "([^"]*)" using the trashbin API$/
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string $originalPath
|
||||
@@ -926,13 +928,13 @@ class TrashbinContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" restores the (?:file|folder|entry) with original path "([^"]*)" using the trashbin API$/')]
|
||||
public function elementInTrashIsRestored(?string $user, string $originalPath): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$this->featureContext->setResponse($this->restoreElement($user, $originalPath));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" restores the following (?:files|folders|entries) with original path$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -940,6 +942,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" restores the following (?:files|folders|entries) with original path$/')]
|
||||
public function userRestoresFollowingFiles(string $user, TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ["path"]);
|
||||
$paths = $table->getHash();
|
||||
@@ -952,7 +955,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has restored the (?:file|folder|entry) with original path "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $originalPath
|
||||
@@ -960,6 +962,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has restored the (?:file|folder|entry) with original path "([^"]*)"$/')]
|
||||
public function elementInTrashHasBeenRestored(string $user, string $originalPath): void {
|
||||
$response = $this->restoreElement($user, $originalPath);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response);
|
||||
@@ -969,7 +972,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" restores the (?:file|folder|entry) with original path "([^"]*)" to "([^"]*)" using the trashbin API$/
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string|null $originalPath
|
||||
@@ -979,6 +981,7 @@ class TrashbinContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" restores the (?:file|folder|entry) with original path "([^"]*)" to "([^"]*)" using the trashbin API$/')]
|
||||
public function userRestoresTheFileWithOriginalPathToUsingTheTrashbinApi(
|
||||
?string $user,
|
||||
?string $originalPath,
|
||||
@@ -989,7 +992,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as "([^"]*)" the (?:file|folder|entry) with original path "([^"]*)" should exist in the trashbin$/
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string|null $originalPath
|
||||
@@ -998,6 +1000,7 @@ class TrashbinContext implements Context {
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^as "([^"]*)" the (?:file|folder|entry) with original path "([^"]*)" should exist in the trashbin$/')]
|
||||
public function elementIsInTrashCheckingOriginalPath(
|
||||
?string $user,
|
||||
?string $originalPath
|
||||
@@ -1010,7 +1013,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as "([^"]*)" the (?:file|folder|entry) with original path "([^"]*)" should not exist in the trashbin/
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string $originalPath
|
||||
@@ -1018,6 +1020,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^as "([^"]*)" the (?:file|folder|entry) with original path "([^"]*)" should not exist in the trashbin/')]
|
||||
public function elementIsNotInTrashCheckingOriginalPath(
|
||||
?string $user,
|
||||
string $originalPath
|
||||
@@ -1030,7 +1033,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as "([^"]*)" the (?:files|folders|entries) with following original paths should not exist in the trashbin$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -1038,6 +1040,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^as "([^"]*)" the (?:files|folders|entries) with following original paths should not exist in the trashbin$/')]
|
||||
public function followingElementsAreNotInTrashCheckingOriginalPath(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -1055,7 +1058,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as "([^"]*)" the (?:files|folders|entries) with following original paths should exist in the trashbin$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -1063,6 +1065,7 @@ class TrashbinContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^as "([^"]*)" the (?:files|folders|entries) with following original paths should exist in the trashbin$/')]
|
||||
public function followingElementsAreInTrashCheckingOriginalPath(
|
||||
string $user,
|
||||
TableNode $table
|
||||
@@ -1118,12 +1121,12 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the deleted (?:file|folder) "([^"]*)" should have the correct deletion mtime in the response$/
|
||||
*
|
||||
* @param string $resource file or folder in trashbin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('/^the deleted (?:file|folder) "([^"]*)" should have the correct deletion mtime in the response$/')]
|
||||
public function theDeletedFileFolderShouldHaveCorrectDeletionMtimeInTheResponse(string $resource): void {
|
||||
$files = $this->getTrashbinContentFromResponseXml(
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse())
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,9 @@ use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\OcHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -134,7 +137,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user locks file :file using the WebDAV API setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -142,6 +144,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user locks file :file using the WebDAV API setting the following properties')]
|
||||
public function userLocksFileSettingPropertiesUsingWebDavAPI(string $user, string $file, TableNode $properties) {
|
||||
$spaceId = null;
|
||||
if (\str_starts_with($file, "Shares/")
|
||||
@@ -155,7 +158,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to lock file/folder :file using the WebDAV API setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -163,6 +165,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user tries to lock file/folder :file using the WebDAV API setting the following properties')]
|
||||
public function userTriesToLockFileSettingPropertiesUsingWebDavAPI(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -173,7 +176,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user locks file :file inside the space :space using the WebDAV API setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -183,6 +185,7 @@ class WebDavLockingContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[When('user :user locks file :file inside the space :space using the WebDAV API setting the following properties')]
|
||||
public function userLocksFileInProjectSpaceUsingWebDavAPI(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -222,7 +225,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has locked file :file inside the space :space setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -232,6 +234,7 @@ class WebDavLockingContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Given('user :user has locked file :file inside the space :space setting the following properties')]
|
||||
public function userHasLockedFileInProjectSpaceUsingWebDavAPI(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -243,7 +246,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to lock file :file inside the space :space using the WebDAV API setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -252,6 +254,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user tries to lock file :file inside the space :space using the WebDAV API setting the following properties')]
|
||||
public function userTriesToLockFileInProjectSpaceUsingWebDavAPI(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -272,7 +275,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user locks file :file using file-id :fileId using the WebDAV API setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -281,6 +283,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user locks file :file using file-id :fileId using the WebDAV API setting the following properties')]
|
||||
public function userLocksFileUsingFileIdUsingWebDavAPISettingFollowingProperties(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -295,7 +298,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to lock file :file using file-id :fileId using the WebDAV API setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -304,6 +306,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user tries to lock file :file using file-id :fileId using the WebDAV API setting the following properties')]
|
||||
public function userTriesToLockFileUsingFileIdUsingWebDavAPI(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -318,7 +321,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has locked file :file setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -326,13 +328,13 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has locked file :file setting the following properties')]
|
||||
public function userHasLockedFile(string $user, string $file, TableNode $properties) {
|
||||
$response = $this->lockFile($user, $file, $properties);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has locked file :file inside space :spaceName setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -341,6 +343,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has locked file :file inside space :spaceName setting the following properties')]
|
||||
public function userHasLockedFileInsideSpaceSettingTheFollowingProperties(
|
||||
string $user,
|
||||
string $file,
|
||||
@@ -353,7 +356,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has locked file :file using file-id :fileId setting the following properties
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -362,6 +364,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('user :user has locked file :file using file-id :fileId setting the following properties')]
|
||||
public function userHasLockedFileUsingFileId(string $user, string $file, string $fileId, TableNode $properties) {
|
||||
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
|
||||
$davPath = \rtrim($davPath, '/');
|
||||
@@ -371,12 +374,12 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the public has locked the last public link shared file/folder setting the following properties
|
||||
*
|
||||
* @param TableNode $properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('the public has locked the last public link shared file/folder setting the following properties')]
|
||||
public function publicHasLockedLastSharedFile(TableNode $properties) {
|
||||
$response = $this->lockFile(
|
||||
$this->featureContext->getLastCreatedPublicShareToken(),
|
||||
@@ -389,13 +392,13 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public locks the last public link shared file using the WebDAV API setting the following properties
|
||||
* @When the public tries to lock the last public link shared file using the WebDAV API setting the following properties
|
||||
*
|
||||
* @param TableNode $properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public locks the last public link shared file using the WebDAV API setting the following properties')]
|
||||
#[When('the public tries to lock the last public link shared file using the WebDAV API setting the following properties')]
|
||||
public function publicLocksLastSharedFile(TableNode $properties) {
|
||||
$token = ($this->featureContext->isUsingSharingNG())
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
@@ -412,13 +415,13 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the public has locked :file in the last public link shared folder setting the following properties
|
||||
*
|
||||
* @param string $file
|
||||
* @param TableNode $properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Given('the public has locked :file in the last public link shared folder setting the following properties')]
|
||||
public function publicHasLockedFileLastSharedFolder(
|
||||
string $file,
|
||||
TableNode $properties
|
||||
@@ -437,14 +440,14 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public locks "([^"]*)" in the last public link shared folder using the public WebDAV API setting the following properties$/
|
||||
* @When /^the public tries to lock "([^"]*)" in the last public link shared folder using the public WebDAV API setting the following properties$/
|
||||
*
|
||||
* @param string $file
|
||||
* @param TableNode $properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public locks :file in the last public link shared folder using the public WebDAV API setting the following properties')]
|
||||
#[When('the public tries to lock :file in the last public link shared folder using the public WebDAV API setting the following properties')]
|
||||
public function publicLocksFileLastSharedFolder(
|
||||
string $file,
|
||||
TableNode $properties
|
||||
@@ -464,13 +467,13 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user unlocks the last created lock of file :file using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user unlocks the last created lock of file :file using the WebDAV API')]
|
||||
public function unlockLastLockUsingWebDavAPI(string $user, string $file) {
|
||||
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||
$user,
|
||||
@@ -482,7 +485,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user unlocks the last created lock of file :file inside space :spaceName using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
@@ -490,6 +492,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user unlocks the last created lock of file :file inside space :spaceName using the WebDAV API')]
|
||||
public function userUnlocksTheLastCreatedLockOfFileInsideSpaceUsingTheWebdavApi(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
@@ -509,7 +512,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user unlocks the last created lock of file :itemToUnlock using file-id :fileId using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $itemToUnlock
|
||||
@@ -517,6 +519,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user unlocks the last created lock of file :itemToUnlock using file-id :fileId using the WebDAV API')]
|
||||
public function userUnlocksTheLastCreatedLockOfFileWithFileIdPathUsingTheWebdavApi(
|
||||
string $user,
|
||||
string $itemToUnlock,
|
||||
@@ -537,7 +540,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user unlocks file :itemToUnlock with the last created lock of file :itemToUseLockOf using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $itemToUnlock
|
||||
@@ -545,6 +547,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user unlocks file :itemToUnlock with the last created lock of file :itemToUseLockOf using the WebDAV API')]
|
||||
public function unlockItemWithLastLockOfOtherItemUsingWebDavAPI(
|
||||
string $user,
|
||||
string $itemToUnlock,
|
||||
@@ -560,7 +563,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user unlocks file :itemToUnlock with the last created public lock of file :itemToUseLockOf using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $itemToUnlock
|
||||
@@ -568,6 +570,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user unlocks file :itemToUnlock with the last created public lock of file :itemToUseLockOf using the WebDAV API')]
|
||||
public function unlockItemWithLastPublicLockOfOtherItemUsingWebDavAPI(
|
||||
string $user,
|
||||
string $itemToUnlock,
|
||||
@@ -626,7 +629,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has unlocked file :itemToUnlock with the last created lock of file :itemToUseLockOf of user :lockOwner using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $itemToUnlock
|
||||
@@ -637,6 +639,7 @@ class WebDavLockingContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
#[Given('user :user has unlocked file :itemToUnlock with the last created lock of file :itemToUseLockOf of user :lockOwner using the WebDAV API')]
|
||||
public function hasUnlockItemWithTheLastCreatedLock(
|
||||
string $user,
|
||||
string $itemToUnlock,
|
||||
@@ -733,7 +736,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user unlocks file :itemToUnlock with the last created lock of file :itemToUseLockOf of user :lockOwner using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $itemToUnlock
|
||||
@@ -742,6 +744,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('user :user unlocks file :itemToUnlock with the last created lock of file :itemToUseLockOf of user :lockOwner using the WebDAV API')]
|
||||
public function userUnlocksItemWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||
string $user,
|
||||
string $itemToUnlock,
|
||||
@@ -758,7 +761,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public unlocks file :itemToUnlock with the last created lock of file :itemToUseLockOf of user :lockOwner using the WebDAV API
|
||||
*
|
||||
* @param string $itemToUnlock
|
||||
* @param string $lockOwner
|
||||
@@ -766,6 +768,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public unlocks file :itemToUnlock with the last created lock of file :itemToUseLockOf of user :lockOwner using the WebDAV API')]
|
||||
public function unlockItemAsPublicWithLastLockOfUserAndItemUsingWebDavAPI(
|
||||
string $itemToUnlock,
|
||||
string $lockOwner,
|
||||
@@ -785,12 +788,12 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public unlocks file :itemToUnlock using the WebDAV API
|
||||
*
|
||||
* @param string $itemToUnlock
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the public unlocks file :itemToUnlock using the WebDAV API')]
|
||||
public function unlockItemAsPublicUsingWebDavAPI(string $itemToUnlock) {
|
||||
$token = ($this->featureContext->isUsingSharingNG())
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
@@ -806,7 +809,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" moves (?:file|folder|entry) "([^"]*)" to "([^"]*)" sending the locktoken of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileSource
|
||||
@@ -815,6 +817,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" moves (?:file|folder|entry) "([^"]*)" to "([^"]*)" sending the locktoken of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/')]
|
||||
public function moveItemSendingLockToken(
|
||||
string $user,
|
||||
string $fileSource,
|
||||
@@ -867,7 +870,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" moves (?:file|folder|entry) "([^"]*)" to "([^"]*)" sending the locktoken of (?:file|folder|entry) "([^"]*)" of user "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $fileSource
|
||||
@@ -877,6 +879,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" moves (?:file|folder|entry) "([^"]*)" to "([^"]*)" sending the locktoken of (?:file|folder|entry) "([^"]*)" of user "([^"]*)" using the WebDAV API$/')]
|
||||
public function userMovesItemSendingLockTokenOfUser(
|
||||
string $user,
|
||||
string $fileSource,
|
||||
@@ -895,7 +898,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" uploads file with content "([^"]*)" to "([^"]*)" sending the locktoken of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $content
|
||||
@@ -904,6 +906,7 @@ class WebDavLockingContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('/^user "([^"]*)" uploads file with content "([^"]*)" to "([^"]*)" sending the locktoken of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/')]
|
||||
public function userUploadsAFileWithContentTo(
|
||||
string $user,
|
||||
string $content,
|
||||
@@ -925,7 +928,6 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then :count locks should be reported for file :file of user :user by the WebDAV API
|
||||
*
|
||||
* @param int $count
|
||||
* @param string $file
|
||||
@@ -934,6 +936,7 @@ class WebDavLockingContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Then(':count locks should be reported for file :file of user :user by the WebDAV API')]
|
||||
public function numberOfLockShouldBeReported(int $count, string $file, string $user) {
|
||||
$lockCount = $this->countLockOfResources($user, $file);
|
||||
Assert::assertEquals(
|
||||
@@ -944,18 +947,17 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the user waits for :time seconds to expire the lock
|
||||
*
|
||||
* @param int $time
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[When('the user waits for :time seconds to expire the lock')]
|
||||
public function waitForCertainSecondsToExpireTheLock(int $time): void {
|
||||
\sleep($time);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then :count locks should be reported for file :file inside the space :space of user :user
|
||||
*
|
||||
* @param int $count
|
||||
* @param string $file
|
||||
@@ -965,6 +967,7 @@ class WebDavLockingContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
#[Then(':count locks should be reported for file :file inside the space :space of user :user')]
|
||||
public function numberOfLockShouldBeReportedInProjectSpace(
|
||||
int $count,
|
||||
string $file,
|
||||
|
||||
@@ -27,6 +27,9 @@ use TestHelpers\Asserts\WebDav as WebDavTest;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use Behat\Step\Given;
|
||||
use Behat\Step\Then;
|
||||
use Behat\Step\When;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -43,7 +46,6 @@ class WebDavPropertiesContext implements Context {
|
||||
private array $storedETAG = [];
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the properties of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -51,6 +53,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets the properties of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/')]
|
||||
public function userGetsThePropertiesOfFolder(
|
||||
string $user,
|
||||
string $path
|
||||
@@ -64,7 +67,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the properties of (?:file|folder|entry) "([^"]*)" with depth (\d+) using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -73,6 +75,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets the properties of (?:file|folder|entry) "([^"]*)" with depth (\\d+) using the WebDAV API$/')]
|
||||
public function userGetsThePropertiesOfFolderWithDepth(
|
||||
string $user,
|
||||
string $path,
|
||||
@@ -118,7 +121,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the following properties of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -127,6 +129,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" gets the following properties of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/')]
|
||||
public function userGetsFollowingPropertiesOfEntryUsingWebDavApi(
|
||||
string $user,
|
||||
string $path,
|
||||
@@ -138,7 +141,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the user gets the following properties of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param TableNode|null $propertiesTable
|
||||
@@ -146,6 +148,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^the user gets the following properties of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/')]
|
||||
public function theUserGetsPropertiesOfFolder(string $path, TableNode $propertiesTable) {
|
||||
$response = $this->getPropertiesOfFolder(
|
||||
$this->featureContext->getCurrentUser(),
|
||||
@@ -157,7 +160,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has set the following properties to (?:file|folder|entry) "([^"]*)" using the WebDav API$/
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $path
|
||||
@@ -168,6 +170,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has set the following properties to (?:file|folder|entry) "([^"]*)" using the WebDav API$/')]
|
||||
public function userHasSetFollowingPropertiesUsingProppatch(
|
||||
string $username,
|
||||
string $path,
|
||||
@@ -189,7 +192,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets a custom property :propertyName of file :path
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $propertyName
|
||||
@@ -198,6 +200,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user gets a custom property :propertyName of file :path')]
|
||||
public function userGetsCustomPropertyOfFile(
|
||||
string $user,
|
||||
string $propertyName,
|
||||
@@ -221,7 +224,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets a custom property :propertyName with namespace :namespace of file :path
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $propertyName
|
||||
@@ -231,6 +233,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user gets a custom property :propertyName with namespace :namespace of file :path')]
|
||||
public function userGetsPropertiesWithNamespaceOfFile(
|
||||
string $user,
|
||||
string $propertyName,
|
||||
@@ -282,7 +285,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public gets the following properties of (?:file|folder|entry) "([^"]*)" in the last created public link using the WebDAV API$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param TableNode $propertiesTable
|
||||
@@ -290,6 +292,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^the public gets the following properties of (?:file|folder|entry) "([^"]*)" in the last created public link using the WebDAV API$/')]
|
||||
public function thePublicGetsFollowingPropertiesOfEntryFromLastLinkShare(
|
||||
string $path,
|
||||
TableNode $propertiesTable
|
||||
@@ -330,7 +333,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" sets property "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)"$/
|
||||
*
|
||||
* @param string $user user id who sets the property
|
||||
* @param string $propertyName name of property in Clark notation
|
||||
@@ -340,6 +342,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" sets property "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)"$/')]
|
||||
public function userSetsPropertyOfEntryTo(
|
||||
string $user,
|
||||
string $propertyName,
|
||||
@@ -356,7 +359,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sets property "([^"]*)" with namespace "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)" using the WebDAV API$/
|
||||
*
|
||||
* @param string $user user id who sets the property
|
||||
* @param string $propertyName name of property in Clark notation
|
||||
@@ -367,6 +369,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('/^user "([^"]*)" sets property "([^"]*)" with namespace "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)" using the WebDAV API$/')]
|
||||
public function userSetsPropertyWithNamespaceOfEntryTo(
|
||||
string $user,
|
||||
string $propertyName,
|
||||
@@ -385,7 +388,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has set property "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)"$/
|
||||
*
|
||||
* @param string $user user id who sets the property
|
||||
* @param string $propertyName name of property in Clark notation
|
||||
@@ -395,6 +397,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has set property "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)"$/')]
|
||||
public function userHasSetPropertyOfEntryTo(
|
||||
string $user,
|
||||
string $propertyName,
|
||||
@@ -411,7 +414,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has set property "([^"]*)" with namespace "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)"$/
|
||||
*
|
||||
* @param string $user user id who sets the property
|
||||
* @param string $propertyName name of property in Clark notation
|
||||
@@ -422,6 +424,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('/^user "([^"]*)" has set property "([^"]*)" with namespace "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)"$/')]
|
||||
public function userHasSetPropertyWithNamespaceOfEntryTo(
|
||||
string $user,
|
||||
string $propertyName,
|
||||
@@ -440,7 +443,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the response should contain a custom "([^"]*)" property with value "(([^"\\]|\\.)*)"$/
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param string $propertyValue
|
||||
@@ -448,6 +450,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the response should contain a custom "([^"]*)" property with value "(([^"\\\\]|\\\\.)*)"$/')]
|
||||
public function theResponseShouldContainCustomPropertyWithValue(string $propertyName, string $propertyValue): void {
|
||||
$propertyValue = \str_replace('\"', '"', $propertyValue);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
@@ -471,7 +474,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the response should contain a custom "([^"]*)" property with namespace "([^"]*)" and value "([^"]*)"$/
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param string $namespaceString
|
||||
@@ -480,6 +482,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the response should contain a custom :propertyName property with namespace :namespaceString and value :propertyValue')]
|
||||
public function theResponseShouldContainACustomPropertyWithNamespaceAndValue(
|
||||
string $propertyName,
|
||||
string $namespaceString,
|
||||
@@ -513,7 +516,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the single response should contain a property :property with a child property :childProperty
|
||||
*
|
||||
* @param string $property
|
||||
* @param string $childProperty
|
||||
@@ -522,6 +524,7 @@ class WebDavPropertiesContext implements Context {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the single response should contain a property :property with a child property :childProperty')]
|
||||
public function theSingleResponseShouldContainAPropertyWithChildProperty(
|
||||
string $property,
|
||||
string $childProperty
|
||||
@@ -536,13 +539,13 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the xml response should contain a property :key
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the xml response should contain a property :key')]
|
||||
public function theResponseShouldContainProperty(string $key): void {
|
||||
$this->checkResponseContainsProperty(
|
||||
$this->featureContext->getResponse(),
|
||||
@@ -551,7 +554,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the xml response should contain a property :key with namespace :namespace
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $namespace
|
||||
@@ -559,6 +561,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the xml response should contain a property :key with namespace :namespace')]
|
||||
public function theResponseShouldContainPropertyWithNamespace(string $key, string $namespace): void {
|
||||
$this->checkResponseContainsProperty(
|
||||
$this->featureContext->getResponse(),
|
||||
@@ -568,7 +571,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the single response should contain a property :key with value :value
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $expectedValue
|
||||
@@ -576,6 +578,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the single response should contain a property :key with value :value')]
|
||||
public function theSingleResponseShouldContainAPropertyWithValue(
|
||||
string $key,
|
||||
string $expectedValue
|
||||
@@ -589,7 +592,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the single response about the file owned by :user should contain a property :key with value :value
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $key
|
||||
@@ -598,6 +600,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the single response about the file owned by :user should contain a property :key with value :value')]
|
||||
public function theSingleResponseAboutTheFileOwnedByShouldContainAPropertyWithValue(
|
||||
string $user,
|
||||
string $key,
|
||||
@@ -613,7 +616,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the single response should contain a property :key with value :value or with value :altValue
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $expectedValue
|
||||
@@ -622,6 +624,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the single response should contain a property :key with value :value or with value :altValue')]
|
||||
public function theSingleResponseShouldContainAPropertyWithValueAndAlternative(
|
||||
string $key,
|
||||
string $expectedValue,
|
||||
@@ -711,7 +714,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the value of the item :xpath in the response should be :value
|
||||
*
|
||||
* @param string $xpath
|
||||
* @param string $expectedValue
|
||||
@@ -719,6 +721,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the value of the item :xpath in the response should be :value')]
|
||||
public function assertValueOfItemInResponseIs(string $xpath, string $expectedValue): void {
|
||||
$this->assertValueOfItemInResponseAboutUserIs(
|
||||
$xpath,
|
||||
@@ -728,7 +731,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then as user :user the value of the item :xpath of path :path in the response should be :value
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $xpath
|
||||
@@ -738,6 +740,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('as user :user the value of the item :xpath of path :path in the response should be :value')]
|
||||
public function valueOfItemOfPathShouldBe(string $user, string $xpath, string $path, string $expectedValue): void {
|
||||
$path = $this->featureContext->substituteInLineCodes($path, $user);
|
||||
$path = \ltrim($path, '/');
|
||||
@@ -751,7 +754,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the value of the item :xpath in the response about user :user should be :value
|
||||
*
|
||||
* @param string $xpath
|
||||
* @param string $user
|
||||
@@ -760,6 +762,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the value of the item :xpath in the response about user :user should be :value')]
|
||||
public function theValueOfTheItemInTheResponseAboutUserShouldBe(
|
||||
string $xpath,
|
||||
string $user,
|
||||
@@ -799,7 +802,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the value of the item :xpath in the response about user :user should be :value1 or :value2
|
||||
*
|
||||
* @param string $xpath
|
||||
* @param string|null $user
|
||||
@@ -809,6 +811,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the value of the item :xpath in the response about user :user should be :value1 or :value2')]
|
||||
public function assertValueOfItemInResponseAboutUserIsEitherOr(
|
||||
string $xpath,
|
||||
?string $user,
|
||||
@@ -865,7 +868,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the value of the item :xpath in the response should match :value
|
||||
*
|
||||
* @param string $xpath
|
||||
* @param string $pattern
|
||||
@@ -873,6 +875,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the value of the item :xpath in the response should match :value')]
|
||||
public function assertValueOfItemInResponseRegExp(string $xpath, string $pattern): void {
|
||||
$this->assertXpathValueMatchesPattern(
|
||||
HttpRequestHelper::getResponseXml($this->featureContext->getResponse()),
|
||||
@@ -882,7 +885,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as a public the lock discovery property "([^"]*)" of the (?:file|folder|entry) "([^"]*)" should match "([^"]*)"$/
|
||||
*
|
||||
* @param string $xpath
|
||||
* @param string $path
|
||||
@@ -891,6 +893,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^as a public the lock discovery property "([^"]*)" of the (?:file|folder|entry) "([^"]*)" should match "([^"]*)"$/')]
|
||||
public function publicGetsThePropertiesOfFolderAndAssertValueOfItemInResponseRegExp(
|
||||
string $xpath,
|
||||
string $path,
|
||||
@@ -907,7 +910,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then there should be an entry with href containing :expectedHref in the response to user :user
|
||||
*
|
||||
* @param string $expectedHref
|
||||
* @param string $user
|
||||
@@ -915,6 +917,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('there should be an entry with href containing :expectedHref in the response to user :user')]
|
||||
public function assertEntryWithHrefMatchingRegExpInResponseToUser(string $expectedHref, string $user): void {
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$this->featureContext->getResponse(),
|
||||
@@ -1019,7 +1022,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as user "([^"]*)" the lock discovery property "([^"]*)" of the (?:file|folder|entry) "([^"]*)" should match "([^"]*)"$/
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string $xpath
|
||||
@@ -1029,6 +1031,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^as user "([^"]*)" the lock discovery property "([^"]*)" of the (?:file|folder|entry) "([^"]*)" should match "([^"]*)"$/')]
|
||||
public function userGetsPropertiesOfFolderAndAssertValueOfItemInResponseToUserRegExp(
|
||||
string $user,
|
||||
string $xpath,
|
||||
@@ -1052,13 +1055,13 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the item :xpath in the response should not exist
|
||||
*
|
||||
* @param string $xpath
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the item :xpath in the response should not exist')]
|
||||
public function assertItemInResponseDoesNotExist(string $xpath): void {
|
||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath($xpath);
|
||||
Assert::assertFalse(
|
||||
@@ -1068,8 +1071,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should contain a property "([^"]*)" with value "([^"]*)" or with value "([^"]*)"$/
|
||||
* @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should contain a property "([^"]*)" with value "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -1079,6 +1080,8 @@ class WebDavPropertiesContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[Then('/^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should contain a property "([^"]*)" with value "([^"]*)" or with value "([^"]*)"$/')]
|
||||
#[Then('/^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should contain a property "([^"]*)" with value "([^"]*)"$/')]
|
||||
public function asUserFolderShouldContainAPropertyWithValueOrWithValue(
|
||||
string $user,
|
||||
string $path,
|
||||
@@ -1126,7 +1129,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the single response should contain a property :key with value like :regex
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $regex
|
||||
@@ -1134,6 +1136,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the single response should contain a property :key with value like :regex')]
|
||||
public function theSingleResponseShouldContainAPropertyWithValueLike(
|
||||
string $key,
|
||||
string $regex
|
||||
@@ -1154,13 +1157,13 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the response should contain a share-types property with
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the response should contain a share-types property with')]
|
||||
public function theResponseShouldContainAShareTypesPropertyWith(TableNode $table): void {
|
||||
$this->featureContext->verifyTableNodeColumnsCount($table, 1);
|
||||
WebdavTest::assertResponseContainsShareTypes(
|
||||
@@ -1170,13 +1173,13 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the response should contain an empty property :property
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the response should contain an empty property :property')]
|
||||
public function theResponseShouldContainAnEmptyProperty(string $property): void {
|
||||
$xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath(
|
||||
"//d:prop/$property"
|
||||
@@ -1225,7 +1228,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user stores etag of element :path using the WebDAV API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -1233,6 +1235,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[When('user :user stores etag of element :path using the WebDAV API')]
|
||||
public function userStoresEtagOfElement(string $user, string $path): void {
|
||||
$this->storeEtagOfElement(
|
||||
$user,
|
||||
@@ -1241,7 +1244,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has stored etag of element :path on path :storePath
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -1250,6 +1252,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has stored etag of element :path on path :storePath')]
|
||||
public function userStoresEtagOfElementOnPath(string $user, string $path, string $storePath): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$this->storeEtagOfElement(
|
||||
@@ -1266,7 +1269,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has stored etag of element :path
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
@@ -1274,6 +1276,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Given('user :user has stored etag of element :path')]
|
||||
public function userHasStoredEtagOfElement(string $user, string $path): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$this->storeEtagOfElement(
|
||||
@@ -1286,11 +1289,11 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the properties response should contain an etag$/
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('the properties response should contain an etag')]
|
||||
public function thePropertiesResponseShouldContainAnEtag(): void {
|
||||
Assert::assertTrue(
|
||||
$this->featureContext->isEtagValid($this->featureContext->getEtagFromResponseXmlObject()),
|
||||
@@ -1317,8 +1320,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then as user :username the last response should have the following properties
|
||||
*
|
||||
* only supports new DAV version
|
||||
*
|
||||
* @param string $username
|
||||
@@ -1330,6 +1331,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('as user :username the last response should have the following properties')]
|
||||
public function theResponseShouldHavePropertyWithValue(string $username, TableNode $expectedPropTable): void {
|
||||
$this->featureContext->verifyTableNodeColumns(
|
||||
$expectedPropTable,
|
||||
@@ -1403,13 +1405,13 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then these etags should not have changed:
|
||||
*
|
||||
* @param TableNode $etagTable
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('these etags should not have changed:')]
|
||||
public function theseEtagsShouldNotHaveChanged(TableNode $etagTable): void {
|
||||
$this->featureContext->verifyTableNodeColumns($etagTable, ["user", "path"]);
|
||||
$this->featureContext->verifyTableNodeColumnsCount($etagTable, 2);
|
||||
@@ -1431,13 +1433,13 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then these etags should have changed:
|
||||
*
|
||||
* @param TableNode $etagTable
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('these etags should have changed:')]
|
||||
public function theseEtagsShouldHaveChanged(TableNode $etagTable): void {
|
||||
$this->featureContext->verifyTableNodeColumns($etagTable, ["user", "path"]);
|
||||
$this->featureContext->verifyTableNodeColumnsCount($etagTable, 2);
|
||||
@@ -1459,7 +1461,6 @@ class WebDavPropertiesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the etag of element "([^"]*)" of user "([^"]*)" (should|should not) have changed$/
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $user
|
||||
@@ -1468,6 +1469,7 @@ class WebDavPropertiesContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Then('/^the etag of element "([^"]*)" of user "([^"]*)" (should|should not) have changed$/')]
|
||||
public function etagOfElementOfUserShouldOrShouldNotHaveChanged(
|
||||
string $path,
|
||||
string $user,
|
||||
|
||||
102
tests/acceptance/scripts/find-unused-steps.sh
Executable file
102
tests/acceptance/scripts/find-unused-steps.sh
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Finds Behat step definitions (in tests/acceptance/bootstrap/*.php) that are never
|
||||
# used by any scenario in tests/acceptance/features/**/*.feature.
|
||||
#
|
||||
# Uses Behat's own RegexPatternPolicy/TurnipPatternPolicy to compile each step
|
||||
# definition pattern into the exact same regex Behat itself uses for matching,
|
||||
# so results are accurate (no custom regex re-implementation).
|
||||
#
|
||||
# This is a reporting tool, not a hard gate: some flagged steps may still be in
|
||||
# use if they are called programmatically from other PHP context code rather
|
||||
# than from a .feature file, which this script cannot detect.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
|
||||
|
||||
php -d error_reporting=E_ALL -- "${ROOT_DIR}" <<'PHP'
|
||||
<?php
|
||||
|
||||
$rootDir = $argv[1];
|
||||
require $rootDir . '/vendor-bin/behat/vendor/autoload.php';
|
||||
|
||||
use Behat\Behat\Definition\Pattern\Policy\RegexPatternPolicy;
|
||||
use Behat\Behat\Definition\Pattern\Policy\TurnipPatternPolicy;
|
||||
|
||||
$bootstrapDir = $rootDir . '/tests/acceptance/bootstrap';
|
||||
$featuresDir = $rootDir . '/tests/acceptance/features';
|
||||
|
||||
$attrRegex = "/^\s*#\[(Given|When|Then)\('(.*)'\)\]\s*$/";
|
||||
|
||||
$definitions = [];
|
||||
foreach (glob($bootstrapDir . '/*.php') as $file) {
|
||||
$lines = file($file);
|
||||
foreach ($lines as $lineNo => $line) {
|
||||
if (preg_match($attrRegex, rtrim($line, "\n"), $m)) {
|
||||
$pattern = str_replace(["\\'", '\\\\'], ["'", '\\'], $m[2]);
|
||||
$definitions[] = [
|
||||
'file' => basename($file),
|
||||
'line' => $lineNo + 1,
|
||||
'keyword' => $m[1],
|
||||
'pattern' => $pattern,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$stepLineRegex = '/^\s*(Given|When|Then|And|But)\s+(.*)$/';
|
||||
$uniqueTexts = [];
|
||||
$featureFiles = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($featuresDir, FilesystemIterator::SKIP_DOTS)
|
||||
);
|
||||
foreach ($featureFiles as $fileInfo) {
|
||||
if ($fileInfo->getExtension() !== 'feature') {
|
||||
continue;
|
||||
}
|
||||
foreach (file($fileInfo->getPathname()) as $line) {
|
||||
if (preg_match($stepLineRegex, rtrim($line, "\n"), $m)) {
|
||||
$uniqueTexts[rtrim($m[2])] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$uniqueTexts = array_keys($uniqueTexts);
|
||||
|
||||
$regexPolicy = new RegexPatternPolicy();
|
||||
$turnipPolicy = new TurnipPatternPolicy();
|
||||
|
||||
$unused = [];
|
||||
foreach ($definitions as $def) {
|
||||
try {
|
||||
$regex = $regexPolicy->supportsPattern($def['pattern'])
|
||||
? $regexPolicy->transformPatternToRegex($def['pattern'])
|
||||
: $turnipPolicy->transformPatternToRegex($def['pattern']);
|
||||
} catch (\Throwable $e) {
|
||||
fwrite(STDERR, "Skipping invalid pattern in {$def['file']}:{$def['line']}: {$e->getMessage()}\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
$matched = false;
|
||||
foreach ($uniqueTexts as $text) {
|
||||
if (@preg_match($regex, $text) === 1) {
|
||||
$matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$matched) {
|
||||
$unused[] = $def;
|
||||
}
|
||||
}
|
||||
|
||||
echo "Checked " . count($definitions) . " step definitions against " . count($uniqueTexts) . " unique feature step texts.\n";
|
||||
echo "Found " . count($unused) . " potentially unused step definitions:\n\n";
|
||||
foreach ($unused as $u) {
|
||||
echo "{$u['file']}:{$u['line']} [{$u['keyword']}] {$u['pattern']}\n";
|
||||
}
|
||||
|
||||
if (count($unused) > 0) {
|
||||
echo "\nNote: a step may be flagged here but still be in use if it's called\n";
|
||||
echo "programmatically from other PHP context code rather than from a .feature file.\n";
|
||||
}
|
||||
PHP
|
||||
Reference in New Issue
Block a user