diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 0ea587a327f..040aaf54191 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -403,6 +403,7 @@ default: - SharingNgContext: - SearchContext: - TagContext: + - TrashbinContext: extensions: rdx\behatvars\BehatVariablesExtension: ~ diff --git a/tests/acceptance/features/bootstrap/CliContext.php b/tests/acceptance/features/bootstrap/CliContext.php index e4ffb69051c..2209ef32a8c 100644 --- a/tests/acceptance/features/bootstrap/CliContext.php +++ b/tests/acceptance/features/bootstrap/CliContext.php @@ -92,6 +92,20 @@ public function theAdministratorResetsThePasswordOfUserUsingTheCLI(string $statu $this->featureContext->updateUserPassword($user, $password); } + /** + * @When the administrator deletes the empty trashbin folders using the CLI + * + * @return void + */ + public function theAdministratorDeletesEmptyTrashbinFolderUsingTheCli():void { + $path = $this->featureContext->getStorageUsersRoot(); + $command = "trash purge-empty-dirs -p $path --dry-run=false"; + $body = [ + "command" => $command + ]; + $this->featureContext->setResponse(CliHelper::runCommand($body)); + } + /** * @When the administrator checks the backup consistency using the CLI * diff --git a/tests/acceptance/features/bootstrap/TrashbinContext.php b/tests/acceptance/features/bootstrap/TrashbinContext.php index 7c0bfc361a1..50e3b44e3f4 100644 --- a/tests/acceptance/features/bootstrap/TrashbinContext.php +++ b/tests/acceptance/features/bootstrap/TrashbinContext.php @@ -650,6 +650,7 @@ public function tryToDeleteFileFromTrashbin(?string $user, ?string $originalPath /** * @When /^user "([^"]*)" deletes the (?:file|folder|entry) with original path "([^"]*)" from the trashbin using the trashbin API$/ + * @Given /^user "([^"]*)" has deleted the (?:file|folder|entry) with original path "([^"]*)" from the trashbin using the trashbin API$/ * * @param string $user * @param string $originalPath diff --git a/tests/acceptance/features/cliCommands/cleanupEmptyTrashBin.feature b/tests/acceptance/features/cliCommands/cleanupEmptyTrashBin.feature new file mode 100644 index 00000000000..75eb2ba47fa --- /dev/null +++ b/tests/acceptance/features/cliCommands/cleanupEmptyTrashBin.feature @@ -0,0 +1,24 @@ +@env-config +Feature: delete empty trash bin folder via CLI command + + + Scenario: delete empty trashbin + Given the user "Admin" has created a new user with the following attributes: + | userName | Alice | + | displayName | Alice Hansen | + | password | %alt1% | + And user "Alice" has created the following folders + | path | + | folder-to-delete | + | folder-to-restore | + And user "Alice" has uploaded file with content "test file" to "testfile.txt" + And user "Alice" has deleted the following resources + | path | + | folder-to-delete | + | folder-to-restore | + | testfile.txt | + And user "Alice" has restored the folder with original path "folder-to-restore" + And user "Alice" has deleted the folder with original path "folder-to-delete" from the trashbin using the trashbin API + And the administrator has stopped the server + When the administrator deletes the empty trashbin folders using the CLI + Then the command should be successful