Load an image
public loadImage ( Imbo\EventManager\EventInterface $event ) | ||
$event | Imbo\EventManager\EventInterface | An event instance |
/** * @covers Imbo\EventListener\StorageOperations::loadImage */ public function testCanLoadImage() { $date = new DateTime(); $this->storage->expects($this->once())->method('getImage')->with($this->publicKey, $this->imageIdentifier)->will($this->returnValue('image data')); $this->storage->expects($this->once())->method('getLastModified')->with($this->publicKey, $this->imageIdentifier)->will($this->returnValue($date)); $this->response->expects($this->once())->method('setLastModified')->with($date)->will($this->returnSelf()); $image = $this->getMock('Imbo\\Model\\Image'); $image->expects($this->once())->method('setBlob')->with('image data'); $this->response->expects($this->once())->method('getModel')->will($this->returnValue($image)); $eventManager = $this->getMock('Imbo\\EventManager\\EventManager'); $eventManager->expects($this->once())->method('trigger')->with('image.loaded'); $this->event->expects($this->once())->method('getManager')->will($this->returnValue($eventManager)); $this->listener->loadImage($this->event); }