protected function setUp() { parent::setUp(); $this->remoteUser = $this->getUniqueID('remoteuser'); $this->storage = $this->getMockBuilder('\\OCA\\Files_Sharing\\External\\Storage')->disableOriginalConstructor()->getMock(); $this->storage->expects($this->any())->method('getId')->will($this->returnValue('dummystorage::')); $this->cache = new \OCA\Files_Sharing\External\Cache($this->storage, 'http://example.com/owncloud', $this->remoteUser); $this->cache->put('test.txt', array('mimetype' => 'text/plain', 'size' => 5, 'mtime' => 123)); }
/** * Returns a storage mock that returns the given value as * free space * * @param int $freeSpace free space value * @return \OC\Files\Storage\Storage */ private function getStorageMock($freeSpace = 12) { $this->storageMock = $this->getMock( '\OC\Files\Storage\Temporary', array('free_space'), array('') ); $this->storageMock->expects($this->once()) ->method('free_space') ->will($this->returnValue(12)); return $this->storageMock; }