예제 #1
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());
 }
예제 #2
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());
 }