cli test for delete empty trash bin directory
This commit is contained in:
@@ -92,6 +92,20 @@ class CliContext implements Context {
|
||||
$this->featureContext->updateUserPassword($user, $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator deletes the empty trashbin folders using the CLI
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theAdministratorDeletesEmptyTrashbinFoldersUsingTheCli():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
|
||||
*
|
||||
|
||||
@@ -671,6 +671,28 @@ class TrashbinContext implements Context {
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has deleted the (?:file|folder|entry) with original path "([^"]*)" from the trashbin$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $originalPath
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userHasDeletedTheFolderWithOriginalPathFromTheTrashbin(string $user, string $originalPath):void {
|
||||
$responseArray = $this->tryToDeleteFileFromTrashbin($user, $originalPath);
|
||||
$numItemDeleted = \count($responseArray);
|
||||
Assert::assertEquals(
|
||||
1,
|
||||
$numItemDeleted,
|
||||
"Expected to delete exactly one item from the trashbin but $numItemDeleted were deleted"
|
||||
);
|
||||
foreach ($responseArray as $response) {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, '', $response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" deletes the following (?:files|folders|entries) with original path from the trashbin$/
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user