Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/tests/Controller/GlobalStoragesControllerTest.php')
-rw-r--r--apps/files_external/tests/Controller/GlobalStoragesControllerTest.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
index f385b1f379e..0963cd06f00 100644
--- a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
@@ -28,6 +28,7 @@ namespace OCA\Files_External\Tests\Controller;
use OC\User\User;
use OCA\Files_External\Controller\GlobalStoragesController;
use OCA\Files_External\Service\BackendService;
+use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\ILogger;
@@ -38,6 +39,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class GlobalStoragesControllerTest extends StoragesControllerTest {
protected function setUp(): void {
parent::setUp();
+
$this->service = $this->getMockBuilder('\OCA\Files_External\Service\GlobalStoragesService')
->disableOriginalConstructor()
->getMock();
@@ -45,11 +47,20 @@ class GlobalStoragesControllerTest extends StoragesControllerTest {
$this->service->method('getVisibilityType')
->willReturn(BackendService::VISIBILITY_ADMIN);
+ $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 GlobalStoragesController(
+ $config = $this->createMock(IConfig::class);
+ $config->method('getSystemValue')
+ ->with('files_external_allow_create_new_local', true)
+ ->willReturn($allowCreateLocal);
+
+ return new GlobalStoragesController(
'files_external',
$this->createMock(IRequest::class),
$this->createMock(IL10N::class),
@@ -57,6 +68,12 @@ class GlobalStoragesControllerTest extends StoragesControllerTest {
$this->createMock(ILogger::class),
$session,
$this->createMock(IGroupManager::class),
+ $config
);
}
+
+ public function testAddLocalStorageWhenDisabled() {
+ $this->controller = $this->createController(false);
+ parent::testAddLocalStorageWhenDisabled();
+ }
}