Example #1
0
 public function testUpdateResponsePage()
 {
     $this->page->getCacheLifeTime()->willReturn('300');
     $this->page->getUuid()->willReturn('1234');
     $this->handler->updateResponse($this->response->reveal(), $this->page->reveal());
     $this->assertEquals('300', $this->parameterBag->get(DebugHandler::HEADER_STRUCTURE_TTL));
 }
Example #2
0
 public function testUpdateResponse()
 {
     $this->response->setPublic()->shouldBeCalled();
     $this->response->setMaxAge($this->maxAge)->shouldBeCalled();
     $this->response->setSharedMaxAge($this->sharedMaxAge)->shouldBeCalled();
     $this->structure->getCacheLifeTime()->willReturn(10);
     $this->response->getAge()->willReturn(50);
     $this->handler->updateResponse($this->response->reveal(), $this->structure->reveal());
 }
Example #3
0
 public function testUpdateResponse()
 {
     $expectedTags = ['structure-1', 'structure-2', 'structure-3', 'structure-4'];
     $this->structure->getUuid()->willReturn('1');
     $this->structure->getProperties(true)->willReturn([$this->property1->reveal(), $this->property2->reveal()]);
     $this->property1->getContentTypeName()->willReturn('type1');
     $this->property2->getContentTypeName()->willReturn('type2');
     $this->contentTypeManager->get('type1')->willReturn($this->contentType1);
     $this->contentTypeManager->get('type2')->willReturn($this->contentType2);
     $this->contentType1->getReferencedUuids(Argument::any())->willReturn(['2']);
     $this->contentType2->getReferencedUuids(Argument::any())->willReturn(['3', '4']);
     $this->parameterBag->set('X-Cache-Tags', implode(',', $expectedTags))->shouldBeCalled();
     $this->handler->updateResponse($this->response->reveal(), $this->structure->reveal());
 }