diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 3a831670d57..584b5088e90 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -399,6 +399,7 @@ default: - FeatureContext: *common_feature_context_params - CliContext: - OcisConfigContext: + - FilesVersionsContext: - SharingNgContext: extensions: diff --git a/tests/acceptance/features/bootstrap/CliContext.php b/tests/acceptance/features/bootstrap/CliContext.php index eccd28a01d9..9d7cdb4b157 100644 --- a/tests/acceptance/features/bootstrap/CliContext.php +++ b/tests/acceptance/features/bootstrap/CliContext.php @@ -82,6 +82,7 @@ public function theAdministratorResetsThePasswordOfUserUsingTheCLI(string $statu "command" => $command, "inputs" => [$password, $password] ]; + $this->featureContext->setResponse(CliHelper::runCommand($body)); if ($status === "non-existing") { return; @@ -103,6 +104,20 @@ public function theAdministratorChecksTheBackupConsistencyUsingTheCli():void { $this->featureContext->setResponse(CliHelper::runCommand($body)); } + /** + * @When the administrator removes all the file versions using the CLI + * + * @return void + */ + public function theAdministratorRemovesAllVersionsOfResources() { + $path = $this->featureContext->getStorageUsersRoot(); + $command = "revisions purge -p $path --dry-run=false"; + $body = [ + "command" => $command + ]; + $this->featureContext->setResponse(CliHelper::runCommand($body)); + } + /** * @Then the command should be successful * diff --git a/tests/acceptance/features/cliCommands/removeFileVersions.feature b/tests/acceptance/features/cliCommands/removeFileVersions.feature new file mode 100644 index 00000000000..dba5e8f5ab1 --- /dev/null +++ b/tests/acceptance/features/cliCommands/removeFileVersions.feature @@ -0,0 +1,15 @@ +@env-config +Feature: remove file versions via CLI command + + + Scenario: remove all file versions + Given user "Alice" has been created with default attributes and without skeleton files + And user "Alice" has uploaded file with content "This is version 1" to "textfile.txt" + And user "Alice" has uploaded file with content "This is version 2" to "textfile.txt" + And user "Alice" has uploaded file with content "This is version 3" to "textfile.txt" + When the administrator removes all the file versions using the CLI + Then the command should be successful + And the command output should contain "✅ Deleted 2 revisions (6 files / 2 blobs)" + When user "Alice" gets the number of versions of file "textfile.txt" + Then the HTTP status code should be "207" + And the number of versions should be "0"