/**
  * @test
  */
 public function setInsertsMetadataThatCanBeFetched()
 {
     $this->frontend->set('foo', 'Bar', array('Tag1', 'Tag2'), 10240);
     $allMetadata = $this->frontend->getAllMetadata();
     $this->assertArrayHasKey('foo', $allMetadata);
     $metadata = $allMetadata['foo'];
     $this->assertEquals(array('Tag1', 'Tag2'), $metadata['tags']);
     $this->assertEquals(10240, $allMetadata['foo']['lifetime']);
 }
 /**
  * Get cache tags and lifetime from the cache metadata that was extracted by the special cache frontend
  *
  * @return array
  */
 protected function getCacheTagsAndLifetime()
 {
     $lifetime = NULL;
     $tags = array();
     $entriesMetadata = $this->contentCacheFrontend->getAllMetadata();
     foreach ($entriesMetadata as $identifier => $metadata) {
         $entryTags = isset($metadata['tags']) ? $metadata['tags'] : array();
         $entryLifetime = isset($metadata['lifetime']) ? $metadata['lifetime'] : NULL;
         if ($entryLifetime !== NULL) {
             if ($lifetime === NULL) {
                 $lifetime = $entryLifetime;
             } else {
                 $lifetime = min($lifetime, $entryLifetime);
             }
         }
         $tags = array_unique(array_merge($tags, $entryTags));
     }
     return array($tags, $lifetime);
 }