public function testMoveCrossStorage() { $storage2 = new Temporary(array()); $cache2 = $storage2->getCache(); Filesystem::mount($storage2, array(), '/bar'); $this->storage->file_put_contents('foo.txt', 'qwerty'); $this->updater->update('foo.txt'); $this->assertTrue($this->cache->inCache('foo.txt')); $this->assertFalse($cache2->inCache('bar.txt')); $cached = $this->cache->get('foo.txt'); // "rename" $storage2->file_put_contents('bar.txt', 'qwerty'); $this->storage->unlink('foo.txt'); $this->assertTrue($this->cache->inCache('foo.txt')); $this->assertFalse($cache2->inCache('bar.txt')); $this->updater->rename('foo.txt', 'bar/bar.txt'); $this->assertFalse($this->cache->inCache('foo.txt')); $this->assertTrue($cache2->inCache('bar.txt')); $cachedTarget = $cache2->get('bar.txt'); $this->assertEquals($cached['mtime'], $cachedTarget['mtime']); $this->assertEquals($cached['size'], $cachedTarget['size']); $this->assertEquals($cached['etag'], $cachedTarget['etag']); $this->assertEquals($cached['fileid'], $cachedTarget['fileid']); }
public function testScanRemovedFile() { $this->fillTestFolders(); $this->scanner->scan(''); $this->assertTrue($this->cache->inCache('folder/bar.txt')); $this->storage->unlink('folder/bar.txt'); $this->scanner->scanFile('folder/bar.txt'); $this->assertFalse($this->cache->inCache('folder/bar.txt')); }
public function testParentSize() { $this->storage->getScanner()->scan(''); $parentCached = $this->cache->get(''); $this->assertEquals(0, $parentCached['size']); $this->storage->file_put_contents('foo.txt', 'bar'); $parentCached = $this->cache->get(''); $this->assertEquals(0, $parentCached['size']); $this->updater->update('foo.txt'); $parentCached = $this->cache->get(''); $this->assertEquals(3, $parentCached['size']); $this->storage->file_put_contents('foo.txt', 'qwerty'); $parentCached = $this->cache->get(''); $this->assertEquals(3, $parentCached['size']); $this->updater->update('foo.txt'); $parentCached = $this->cache->get(''); $this->assertEquals(6, $parentCached['size']); $this->storage->unlink('foo.txt'); $parentCached = $this->cache->get(''); $this->assertEquals(6, $parentCached['size']); $this->updater->remove('foo.txt'); $parentCached = $this->cache->get(''); $this->assertEquals(0, $parentCached['size']); }
/** * see http://php.net/manual/en/function.unlink.php * * @param string $path * @return bool */ public function unlink($path) { return $this->storage->unlink($path); }