addHeader() public method

Add the HashTwo header to the response
public addHeader ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The current event
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);
 }