Example #1
0
 public function testGetStoragesAuthMechanismNotVisible()
 {
     $backend = $this->backendService->getBackend('identifier:\\OCA\\Files_External\\Lib\\Backend\\SMB');
     $backend->method('isVisibleFor')->with($this->service->getVisibilityType())->willReturn(true);
     $authMechanism = $this->backendService->getAuthMechanism('identifier:\\Auth\\Mechanism');
     $authMechanism->expects($this->once())->method('isVisibleFor')->with($this->service->getVisibilityType())->willReturn(false);
     $storage = new StorageConfig(255);
     $storage->setMountPoint('mountpoint');
     $storage->setBackend($backend);
     $storage->setAuthMechanism($authMechanism);
     $storage->setBackendOptions(['password' => 'testPassword']);
     $newStorage = $this->service->addStorage($storage);
     $this->assertCount(1, $this->service->getAllStorages());
     $this->assertEmpty($this->service->getStorages());
 }
Example #2
0
 public function testCreateStorage()
 {
     $mountPoint = 'mount';
     $backendIdentifier = 'identifier:\\OCA\\Files_External\\Lib\\Backend\\SMB';
     $authMechanismIdentifier = 'identifier:\\Auth\\Mechanism';
     $backendOptions = ['param' => 'foo', 'param2' => 'bar'];
     $mountOptions = ['option' => 'foobar'];
     $applicableUsers = ['user1', 'user2'];
     $applicableGroups = ['group'];
     $priority = 123;
     $backend = $this->backendService->getBackend($backendIdentifier);
     $authMechanism = $this->backendService->getAuthMechanism($authMechanismIdentifier);
     $storage = $this->service->createStorage($mountPoint, $backendIdentifier, $authMechanismIdentifier, $backendOptions, $mountOptions, $applicableUsers, $applicableGroups, $priority);
     $this->assertEquals('/' . $mountPoint, $storage->getMountPoint());
     $this->assertEquals($backend, $storage->getBackend());
     $this->assertEquals($authMechanism, $storage->getAuthMechanism());
     $this->assertEquals($backendOptions, $storage->getBackendOptions());
     $this->assertEquals($mountOptions, $storage->getMountOptions());
     $this->assertEquals($applicableUsers, $storage->getApplicableUsers());
     $this->assertEquals($applicableGroups, $storage->getApplicableGroups());
     $this->assertEquals($priority, $storage->getPriority());
 }