This event listener can be used to send HashTwo headers for Varnish.
Author: Christer Edvartsen (cogo@starzinger.net)
Inheritance: implements Imbo\EventListener\ListenerInterface
Beispiel #1
0
 /**
  * @covers Imbo\EventListener\VarnishHashTwo::__construct
  * @covers Imbo\EventListener\VarnishHashTwo::addHeader
  */
 public function testCanSpecifyACustomHeaderName()
 {
     $listener = new VarnishHashTwo(['headerName' => 'X-CustomHeader']);
     $this->request->expects($this->once())->method('getUser')->will($this->returnValue('user'));
     $image = $this->getMock('Imbo\\Model\\Image');
     $image->expects($this->once())->method('getImageIdentifier')->will($this->returnValue('id'));
     $this->response->expects($this->once())->method('getModel')->will($this->returnValue($image));
     $this->responseHeaders->expects($this->once())->method('set')->with('X-CustomHeader', ['imbo;image;user;id', 'imbo;user;user']);
     $listener->addHeader($this->event);
 }