コード例 #1
0
 public function testMetaDataSuccess()
 {
     $temp = $this->createTempDir(__CLASS__);
     $meta = new ezcCacheStackLruMetaData();
     $meta->setState(array('replacementData' => array('id_1' => 23, 'id_2' => 42), 'storageData' => array('storage_id_1' => array('id_1' => true, 'id_2' => true), 'storage_id_2' => array('id_2' => true))));
     $storage = new ezcCacheStorageFileArray($temp);
     $this->assertFalse(file_exists($storage->getLocation() . $storage->options->metaDataFile), 'Meta data file existed before the storage was created.');
     $storage->storeMetaData($meta);
     $this->assertTrue(file_exists($storage->getLocation() . $storage->options->metaDataFile), 'Meta data file existed before the storage was created.');
     $restoredMeta = $storage->restoreMetaData();
     $this->assertEquals($meta, $restoredMeta, 'Meta data not restored correctly.');
     $this->assertTrue(file_exists($storage->getLocation() . $storage->options->metaDataFile), 'Meta data does not exist anymore after restoring.');
     $this->removeTempDir();
 }