public function testGetStorage() { $path = '/foo/bar.txt'; $this->filesMock->expects($this->once())->method('getMount')->with($path)->willReturn($this->mountMock); $this->mountMock->expects($this->once())->method('getStorage')->willReturn(true); $this->assertTrue($this->instance->getStorage($path)); }
public function testGetStorage() { $return = $this->getMockBuilder('OC\\Files\\Storage\\Storage')->disableOriginalConstructor()->getMock(); $path = '/foo/bar.txt'; $this->filesMock->expects($this->once())->method('getMount')->with($path)->willReturn($this->mountMock); $this->mountMock->expects($this->once())->method('getStorage')->willReturn($return); $this->assertEquals($return, $this->instance->getStorage($path)); }
/** * should the file be encrypted or not * * @param string $path * @return boolean */ public function shouldEncrypt($path) { if ($this->util->shouldEncryptHomeStorage() === false) { $storage = $this->util->getStorage($path); if ($storage->instanceOfStorage('\\OCP\\Files\\IHomeStorage')) { return false; } } $parts = explode('/', $path); if (count($parts) < 4) { return false; } if ($parts[2] == 'files') { return true; } if ($parts[2] == 'files_versions') { return true; } if ($parts[2] == 'files_trashbin') { return true; } return false; }