Esempio n. 1
0
 public function testUpdateLegacyAndNewId()
 {
     // add storage ids
     $oldCache = new \OC\Files\Cache\Cache($this->oldId);
     new \OC\Files\Cache\Cache($this->newId);
     // add file to old cache
     $fileId = $oldCache->put('/', array('size' => 0, 'mtime' => time(), 'mimetype' => 'httpd/directory'));
     try {
         $this->instance = new \OC\Files\Storage\AmazonS3($this->params);
     } catch (\Exception $e) {
         //ignore
     }
     $storages = $this->getStorages();
     $this->assertTrue(isset($storages[$this->newId]));
     $this->assertFalse(isset($storages[$this->oldId]));
     $this->assertNull(\OC\Files\Cache\Cache::getById($fileId), 'old filecache has not been cleared');
 }
 /**
  * Create dummy data in the filecache for the given storage numeric id
  *
  * @param string $storageId storage id
  */
 private function createData($storageId)
 {
     $cache = new \OC\Files\Cache\Cache($storageId);
     $cache->put('dummyfile.txt', array('size' => 5, 'mtime' => 12, 'mimetype' => 'text/plain'));
 }