diff options
Diffstat (limited to 'apps/files_external/tests/Controller/UserStoragesControllerTest.php')
-rw-r--r-- | apps/files_external/tests/Controller/UserStoragesControllerTest.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php index c9e4ec5f985..f4de39fcd2b 100644 --- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php +++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php @@ -31,6 +31,7 @@ use OCA\Files_External\Controller\UserStoragesController; use OCA\Files_External\Lib\StorageConfig; use OCA\Files_External\Service\BackendService; use OCP\AppFramework\Http; +use OCP\IConfig; use OCP\IGroupManager; use OCP\IL10N; use OCP\ILogger; @@ -54,21 +55,36 @@ class UserStoragesControllerTest extends StoragesControllerTest { $this->service->method('getVisibilityType') ->willReturn(BackendService::VISIBILITY_PERSONAL); + $this->controller = $this->createController(true); + } + + private function createController($allowCreateLocal = true) { $session = $this->createMock(IUserSession::class); $session->method('getUser') ->willReturn(new User('test', null, $this->createMock(EventDispatcherInterface::class))); - $this->controller = new UserStoragesController( + $config = $this->createMock(IConfig::class); + $config->method('getSystemValue') + ->with('files_external_allow_create_new_local', true) + ->willReturn($allowCreateLocal); + + return new UserStoragesController( 'files_external', $this->createMock(IRequest::class), $this->createMock(IL10N::class), $this->service, $this->createMock(ILogger::class), $session, - $this->createMock(IGroupManager::class) + $this->createMock(IGroupManager::class), + $config ); } + public function testAddLocalStorageWhenDisabled() { + $this->controller = $this->createController(false); + parent::testAddLocalStorageWhenDisabled(); + } + public function testAddOrUpdateStorageDisallowedBackend() { $backend = $this->getBackendMock(); $backend->method('isVisibleFor') |