/** * Prepare resize configuration object. * * @return ResizeConfiguration */ protected function prepareResizeConfig() { $resizeConfig = new ResizeConfiguration(); $resizeConfig->setWidth($this->targetWidth); $resizeConfig->setHeight($this->targetHeight); $resizeConfig->setZoomLevel($this->zoomLevel); if (substr_count($this->resizeMode, '_') === 1) { $resizeConfig->setMode(ResizeConfiguration::MODE_CROP); $resizeConfig->setZoomLevel(0); } else { try { $resizeConfig->setMode($this->resizeMode); } catch (\InvalidArgumentException $exception) { $resizeConfig->setMode(ResizeConfiguration::MODE_CROP); } } return $resizeConfig; }
/** * Tests the setZoomLevel() method. * * @expectedException \InvalidArgumentException */ public function testSetZoomLevelTooHigh() { $config = new ResizeConfiguration(); $this->setExpectedException('InvalidArgumentException'); $config->setZoomLevel(101); }