From b079d3c6f671c1fab6fecd1ccd3d429aaf4ed09f Mon Sep 17 00:00:00 2001 From: Sabin Date: Tue, 16 Jul 2024 15:37:00 +0545 Subject: [PATCH] cli test for delete empty trash bin directory --- tests/acceptance/features/bootstrap/CliContext.php | 14 ++++++++++++++ .../cliCommands/cleanupEmptyTrashBin.feature | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/acceptance/features/cliCommands/cleanupEmptyTrashBin.feature diff --git a/tests/acceptance/features/bootstrap/CliContext.php b/tests/acceptance/features/bootstrap/CliContext.php index e4ffb69051c..19070d8268a 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 empty folder inside trashbin 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/cliCommands/cleanupEmptyTrashBin.feature b/tests/acceptance/features/cliCommands/cleanupEmptyTrashBin.feature new file mode 100644 index 00000000000..15b227282b9 --- /dev/null +++ b/tests/acceptance/features/cliCommands/cleanupEmptyTrashBin.feature @@ -0,0 +1,14 @@ +@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 folder "/folderMain" + And user "Alice" has deleted folder "/folderMain" + And the administrator has stopped the server + When the administrator deletes empty folder inside trashbin using the CLI + Then the command should be successful