setETag() public method

Set the correct ETag for the response
public setETag ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The current event
Beispiel #1
0
 /**
  * @dataProvider getRoutesForETags
  */
 public function testWillSetETagForSomeRoutes($route, $hasETag, $isOk = false, $content = null)
 {
     $request = $this->getMock('Imbo\\Http\\Request\\Request');
     $request->expects($this->once())->method('getRoute')->will($this->returnValue($route));
     $response = $this->getMock('Imbo\\Http\\Response\\Response');
     if ($hasETag) {
         $response->expects($this->once())->method('isOk')->will($this->returnValue($isOk));
         if ($isOk) {
             $response->expects($this->once())->method('getContent')->will($this->returnValue($content));
             $response->expects($this->once())->method('setETag')->with('"' . md5($content) . '"');
         }
     } else {
         $response->expects($this->never())->method('isOk');
     }
     $event = $this->getMock('Imbo\\EventManager\\Event');
     $event->expects($this->once())->method('getRequest')->will($this->returnValue($request));
     $event->expects($this->once())->method('getResponse')->will($this->returnValue($response));
     $this->listener->setETag($event);
 }