public function testUsesAllParams($params, $originalWidth, $originalHeight, $width, $height, $x = 0, $y = 0, $shouldCrop = true)
{
$image = $this->getMock('Imbo\\Model\\Image');
$imagick = $this->getMock('Imagick');
$image->expects($this->any())->method('getWidth')->will($this->returnValue($originalWidth));
$image->expects($this->any())->method('getHeight')->will($this->returnValue($originalHeight));
if ($shouldCrop) {
$image->expects($this->once())->method('setWidth')->with($width)->will($this->returnSelf());
$image->expects($this->once())->method('setHeight')->with($height)->will($this->returnSelf());
$imagick->expects($this->once())->method('cropImage')->with($width, $height, $x, $y);
$imagick->expects($this->once())->method('getImageGeometry')->will($this->returnValue(['width' => $width, 'height' => $height]));
} else {
$imagick->expects($this->never())->method('cropImage');
}
$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));
$crop = new Crop();
$crop->setImagick($imagick)->transform($event);
}