/**
  * @test
  */
 public function addHeadersInLiveWorkspaceAndCachedResponseWithDefaultAndLargeEntryLifetime()
 {
     $this->mockContext->expects($this->any())->method('getWorkspaceName')->willReturn('live');
     $this->service->injectSettings(array('cacheHeaders' => array('defaultSharedMaximumAge' => 86400)));
     $this->contentCacheFrontend->set('entry1', 'Foo', array('Tag1'), 124800);
     $this->mockResponse->expects($this->atLeastOnce())->method('setSharedMaximumAge')->with(86400);
     $this->service->addHeaders($this->mockRequest, $this->mockResponse, $this->mockController);
 }
 /**
  * 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);
 }
 /**
  * @test
  */
 public function getByTagDoesNotReturnMetadata()
 {
     $this->frontend->set('foo', 'Bar', array('Tag1', 'Tag2'), 10240);
     $entries = $this->frontend->getByTag('Tag2');
     $this->assertEquals(array('foo' => 'Bar'), $entries);
 }