getImage() public method

Handle GET and HEAD requests
public getImage ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface
Beispiel #1
0
 /**
  * @covers Imbo\Resource\Image::getImage
  */
 public function testSupportsHttpGet()
 {
     $publicKey = 'christer';
     $imageIdentifier = 'imageIdentifier';
     $responseHeaders = $this->getMock('Symfony\\Component\\HttpFoundation\\HeaderBag');
     $this->request->expects($this->once())->method('getPublicKey')->will($this->returnValue($publicKey));
     $this->request->expects($this->once())->method('getImageIdentifier')->will($this->returnValue($imageIdentifier));
     $this->response->headers = $responseHeaders;
     $this->response->expects($this->once())->method('setModel')->with($this->isInstanceOf('Imbo\\Model\\Image'));
     $this->manager->expects($this->at(0))->method('trigger')->with('db.image.load');
     $this->manager->expects($this->at(1))->method('trigger')->with('storage.image.load');
     $this->response->expects($this->once())->method('setMaxAge')->with(31536000)->will($this->returnSelf());
     $responseHeaders->expects($this->once())->method('add')->with($this->callback(function ($headers) {
         return array_key_exists('X-Imbo-OriginalMimeType', $headers) && array_key_exists('X-Imbo-OriginalWidth', $headers) && array_key_exists('X-Imbo-OriginalHeight', $headers) && array_key_exists('X-Imbo-OriginalFileSize', $headers) && array_key_exists('X-Imbo-OriginalExtension', $headers);
     }));
     $this->resource->getImage($this->event);
 }