public function testThrowsOnInvalidCropParams($params, $originalWidth, $originalHeight, $errRegex)
{
$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 ($errRegex) {
$this->setExpectedExceptionRegExp('Imbo\\Exception\\TransformationException', $errRegex);
$imagick->expects($this->never())->method('cropImage');
} else {
$image->expects($this->once())->method('setWidth')->will($this->returnSelf());
$image->expects($this->once())->method('setHeight')->will($this->returnSelf());
$imagick->expects($this->once())->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);
}