public function testFopenExistingFileNoUpdate()
 {
     $this->sourceStorage->touch('foo');
     $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
     $this->assertFalse($storage->fopen('foo', 'w'));
 }
Exemplo n.º 2
0
 public function testPropagateEtag()
 {
     $storage = new Temporary(array());
     $mount = new MountPoint($storage, '');
     Filesystem::getMountManager()->addMount($mount);
     $cache = $storage->getCache();
     $storage->mkdir('folder');
     $storage->file_put_contents('folder/bar.txt', 'qwerty');
     $storage->touch('folder/bar.txt', time() - 200);
     $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), \OC::$server->getLogger());
     $scanner->addMount($mount);
     $scanner->scan('');
     $this->assertTrue($cache->inCache('folder/bar.txt'));
     $oldRoot = $cache->get('');
     $storage->file_put_contents('folder/bar.txt', 'qwerty');
     $scanner->scan('');
     $newRoot = $cache->get('');
     $this->assertNotEquals($oldRoot->getEtag(), $newRoot->getEtag());
 }