diff options
Diffstat (limited to 'apps/files_external/tests/controller')
-rw-r--r-- | apps/files_external/tests/controller/storagescontrollertest.php | 16 | ||||
-rw-r--r-- | apps/files_external/tests/controller/userstoragescontrollertest.php | 16 |
2 files changed, 24 insertions, 8 deletions
diff --git a/apps/files_external/tests/controller/storagescontrollertest.php b/apps/files_external/tests/controller/storagescontrollertest.php index 2b0ee7a14ea..c43761f3bcb 100644 --- a/apps/files_external/tests/controller/storagescontrollertest.php +++ b/apps/files_external/tests/controller/storagescontrollertest.php @@ -75,10 +75,12 @@ abstract class StoragesControllerTest extends \Test\TestCase { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->willReturn(true); + $authMech->method('isPermitted') + ->willReturn(true); $backend = $this->getBackendMock(); $backend->method('validateStorage') ->willReturn(true); - $backend->method('isVisibleFor') + $backend->method('isPermitted') ->willReturn(true); $storageConfig = new StorageConfig(1); @@ -114,10 +116,12 @@ abstract class StoragesControllerTest extends \Test\TestCase { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->willReturn(true); + $authMech->method('isPermitted') + ->willReturn(true); $backend = $this->getBackendMock(); $backend->method('validateStorage') ->willReturn(true); - $backend->method('isVisibleFor') + $backend->method('isPermitted') ->willReturn(true); $storageConfig = new StorageConfig(1); @@ -245,10 +249,12 @@ abstract class StoragesControllerTest extends \Test\TestCase { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->willReturn(true); + $authMech->method('isPermitted') + ->willReturn(true); $backend = $this->getBackendMock(); $backend->method('validateStorage') ->willReturn(true); - $backend->method('isVisibleFor') + $backend->method('isPermitted') ->willReturn(true); $storageConfig = new StorageConfig(255); @@ -332,12 +338,14 @@ abstract class StoragesControllerTest extends \Test\TestCase { $backend = $this->getBackendMock(); $backend->method('validateStorage') ->willReturn($backendValidate); - $backend->method('isVisibleFor') + $backend->method('isPermitted') ->willReturn(true); $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->will($this->returnValue($authMechValidate)); + $authMech->method('isPermitted') + ->willReturn(true); $storageConfig = new StorageConfig(); $storageConfig->setMountPoint('mount'); diff --git a/apps/files_external/tests/controller/userstoragescontrollertest.php b/apps/files_external/tests/controller/userstoragescontrollertest.php index 9f1a8df8d2e..b61174b0797 100644 --- a/apps/files_external/tests/controller/userstoragescontrollertest.php +++ b/apps/files_external/tests/controller/userstoragescontrollertest.php @@ -49,15 +49,21 @@ class UserStoragesControllerTest extends StoragesControllerTest { } public function testAddOrUpdateStorageDisallowedBackend() { - $backend = $this->getBackendMock(); - $backend->method('isVisibleFor') - ->with(BackendService::VISIBILITY_PERSONAL) + $backend1 = $this->getBackendMock(); + $backend1->expects($this->once()) + ->method('isPermitted') + ->with(BackendService::USER_PERSONAL, BackendService::PERMISSION_CREATE) + ->willReturn(false); + $backend2 = $this->getBackendMock(); + $backend2->expects($this->once()) + ->method('isPermitted') + ->with(BackendService::USER_PERSONAL, BackendService::PERMISSION_MODIFY) ->willReturn(false); $authMech = $this->getAuthMechMock(); $storageConfig = new StorageConfig(1); $storageConfig->setMountPoint('mount'); - $storageConfig->setBackend($backend); + $storageConfig->setBackend($backend1); $storageConfig->setAuthMechanism($authMech); $storageConfig->setBackendOptions([]); @@ -82,6 +88,8 @@ class UserStoragesControllerTest extends StoragesControllerTest { $this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); + $storageConfig->setBackend($backend2); + $response = $this->controller->update( 1, 'mount', |