public function testDeleteStorage() { $storage = new StorageConfig(255); $storage->setMountPoint('mountpoint'); $storage->setBackendClass('\\OC\\Files\\Storage\\SMB'); $storage->setBackendOptions(['password' => 'testPassword']); $newStorage = $this->service->addStorage($storage); $this->assertEquals(1, $newStorage->getId()); $newStorage = $this->service->removeStorage(1); $caught = false; try { $this->service->getStorage(1); } catch (NotFoundException $e) { $caught = true; } $this->assertTrue($caught); }
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()); }
public function testDeleteStorage() { $backend = $this->backendService->getBackend('identifier:\\OCA\\Files_External\\Lib\\Backend\\SMB'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\\Auth\\Mechanism'); $storage = new StorageConfig(255); $storage->setMountPoint('mountpoint'); $storage->setBackend($backend); $storage->setAuthMechanism($authMechanism); $storage->setBackendOptions(['password' => 'testPassword']); $newStorage = $this->service->addStorage($storage); $this->assertEquals(1, $newStorage->getId()); $newStorage = $this->service->removeStorage(1); $caught = false; try { $this->service->getStorage(1); } catch (NotFoundException $e) { $caught = true; } $this->assertTrue($caught); }