public function testCanTransformImages($file, $params, $width, $height, $transformedWidth, $transformedHeight, $transformation = true)
{
$image = $this->getMock('Imbo\\Model\\Image');
$image->expects($this->once())->method('getWidth')->will($this->returnValue($width));
$image->expects($this->once())->method('getHeight')->will($this->returnValue($height));
if ($transformation) {
$image->expects($this->once())->method('setWidth')->with($transformedWidth)->will($this->returnValue($image));
$image->expects($this->once())->method('setHeight')->with($transformedHeight)->will($this->returnValue($image));
$image->expects($this->once())->method('hasBeenTransformed')->with(true)->will($this->returnValue($image));
} else {
$image->expects($this->never())->method('setWidth');
$image->expects($this->never())->method('setHeight');
$image->expects($this->never())->method('hasBeenTransformed');
}
$event = $this->getMock('Imbo\\EventManager\\Event');
$event->expects($this->at(0))->method('getArgument')->with('image')->will($this->returnValue($image));
$event->expects($this->at(1))->method('getArgument')->with('params')->will($this->returnValue($params));
$imagick = new Imagick();
$imagick->readImageBlob(file_get_contents($file));
$this->getTransformation()->setImagick($imagick)->transform($event);
}