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()); }
/** * @expectedException \OCA\Files_external\NotFoundException */ public function testDeleteUnexistingStorage() { $this->service->removeStorage(255); }
/** * @expectedException \InvalidArgumentException */ public function testCreateStorageInvalidAuthMechanismClass() { $this->service->createStorage('mount', 'identifier:\\OCA\\Files_External\\Lib\\Backend\\SMB', 'identifier:\\Not\\An\\Auth\\Mechanism', []); }