diff options
author | Matthias Held <ilovemilk@wusa.io> | 2020-12-19 17:45:21 +0300 |
---|---|---|
committer | Matthias Held <ilovemilk@wusa.io> | 2020-12-19 17:45:21 +0300 |
commit | cf02891164debc5cd9d2de6cc909a0fc1e021709 (patch) | |
tree | 59b30c4ab900dd18a52817b6178a5073ad70ffda | |
parent | 50d2926ce672bf31513b978b9c8059c839e733a9 (diff) |
never recover files with an empty path or file name
-rw-r--r-- | tests/Unit/Controller/FileOperationControllerTest.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/Unit/Controller/FileOperationControllerTest.php b/tests/Unit/Controller/FileOperationControllerTest.php index 86d351c..af6e28d 100644 --- a/tests/Unit/Controller/FileOperationControllerTest.php +++ b/tests/Unit/Controller/FileOperationControllerTest.php @@ -172,9 +172,21 @@ class FileOperationControllerTest extends TestCase $fileOperationUserFolder->setFileId(3); $fileOperationUserFolder->setOriginalName('test.jpg'); + $fileOperationEmptyPath = new FileOperation(); + $fileOperationEmptyPath->setCommand(Monitor::RENAME); + $fileOperationEmptyPath->setFileId(2); + $fileOperationEmptyPath->setOriginalName('test.jpg'); + + $fileOperationEmptyName= new FileOperation(); + $fileOperationEmptyName->setCommand(Monitor::RENAME); + $fileOperationEmptyName->setPath('/admin/file'); + $fileOperationEmptyName->setFileId(2); + return [ ['id' => 4, 'fileOperation' => new FileOperation(), 'deleted' => false, 'response' => Http::STATUS_BAD_REQUEST], ['id' => 3, 'fileOperation' => $fileOperationUserFolder, 'deleted' => false, 'response' => Http::STATUS_BAD_REQUEST], + ['id' => 2, 'fileOperation' => $fileOperationEmptyPath, 'deleted' => false, 'response' => Http::STATUS_BAD_REQUEST], + ['id' => 2, 'fileOperation' => $fileOperationEmptyName, 'deleted' => false, 'response' => Http::STATUS_BAD_REQUEST], ['id' => 2, 'fileOperation' => $fileOperationRead, 'deleted' => true, 'response' => Http::STATUS_OK], ['id' => 2, 'fileOperation' => $fileOperationRename, 'deleted' => true, 'response' => Http::STATUS_OK], // needs more mocking |