diff --git a/tests/acceptance/features/bootstrap/OccContext.php b/tests/acceptance/features/bootstrap/OccContext.php index 7720de93cc99..2262773d2fd5 100644 --- a/tests/acceptance/features/bootstrap/OccContext.php +++ b/tests/acceptance/features/bootstrap/OccContext.php @@ -385,6 +385,16 @@ public function deleteLastBackgroundJobUsingTheOccCommand($job) { $this->lastDeletedJobId = $match; } + /** + * List created local storage mount + * + * @return void + * @throws Exception + */ + public function listLocalStorageMount() { + $this->invokingTheCommand('files_external:list --output=json'); + } + /** * @When the administrator enables DAV tech_preview * @@ -1165,6 +1175,35 @@ public function theAdminHasAddedRemovedTheApplicableUserForMountUsingTheOccComma $this->theCommandShouldHaveBeenSuccessful(); } + /** + * @When the administrator lists the local storage using the occ command + * + * @return void + * @throws Exception + */ + public function userListsLocalStorageMountUsingTheOccCommand() { + $this->listLocalStorageMount(); + } + + /** + * @Then the following local storage should exist + * + * @param TableNode $mountPoints + * + * @return void + */ + public function theFollowingLocalStoragesShouldExist(TableNode $mountPoints) { + $createdLocalStorage = []; + $expectedLocalStorages = $mountPoints->getColumnsHash(); + $commandOutput = \json_decode($this->featureContext->getStdOutOfOccCommand()); + foreach ($commandOutput as $storageEntry) { + $createdLocalStorage[$storageEntry->mount_id] = \ltrim($storageEntry->mount_point, '/'); + } + foreach ($expectedLocalStorages as $expectedStorageEntry) { + Assert::assertContains($expectedStorageEntry['localStorage'], $createdLocalStorage); + } + } + /** * @When the administrator list the repair steps using the occ command * diff --git a/tests/acceptance/features/cliLocalStorage/listLocalStorage.feature b/tests/acceptance/features/cliLocalStorage/listLocalStorage.feature new file mode 100644 index 000000000000..6e040a074df4 --- /dev/null +++ b/tests/acceptance/features/cliLocalStorage/listLocalStorage.feature @@ -0,0 +1,16 @@ +@cli @skipOnLDAP @local_storage +Feature: create local storage from the command line + As an admin + I want to list all created local storage from the command line + So that I can view available local storage + + Scenario: List the created local storage + Given the administrator has created the local storage mount "local_storage2" + And the administrator has created the local storage mount "new_local_storage" + And the administrator has uploaded file with content "this is a file in local storage" to "/local_storage2/file-in-local-storage.txt" + And the administrator has uploaded file with content "new file" to "/new_local_storage/new-file" + When the administrator lists the local storage using the occ command + Then the following local storage should exist + | localStorage | + | local_storage2 | + | new_local_storage | \ No newline at end of file