From 931ecb1b734d0caf9540935bdd3f8523af4cc85a Mon Sep 17 00:00:00 2001 From: Dmitry Kulikov Date: Mon, 28 Dec 2020 12:48:18 +0600 Subject: [PATCH] Try-catch in \Imagine\Gmagick\Effects::convolve should catch \GmagickException instead of \ImagickException. Changed the case of the Gmagick methods calls to lowercase to match their declarations. \Imagine\Test\Gmagick\EffectsTest::testColorize now expects more specific NotSupportedException instead of rather common RuntimeException. --- src/Gmagick/Effects.php | 6 +++--- tests/tests/Gmagick/EffectsTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Gmagick/Effects.php b/src/Gmagick/Effects.php index f62cc42ae..d918c5779 100644 --- a/src/Gmagick/Effects.php +++ b/src/Gmagick/Effects.php @@ -82,7 +82,7 @@ public function negative() public function grayscale() { try { - $this->gmagick->setImageType(2); + $this->gmagick->setimagetype(2); } catch (\GmagickException $e) { throw new RuntimeException('Failed to grayscale the image', $e->getCode(), $e); } @@ -118,7 +118,7 @@ public function sharpen() public function blur($sigma = 1) { try { - $this->gmagick->blurImage(0, $sigma); + $this->gmagick->blurimage(0, $sigma); } catch (\GmagickException $e) { throw new RuntimeException('Failed to blur the image', $e->getCode(), $e); } @@ -168,7 +168,7 @@ public function convolve(Matrix $matrix) } try { $this->gmagick->convolveimage($matrix->getValueList()); - } catch (\ImagickException $e) { + } catch (\GmagickException $e) { throw new RuntimeException('Failed to convolve the image'); } diff --git a/tests/tests/Gmagick/EffectsTest.php b/tests/tests/Gmagick/EffectsTest.php index ac86301c7..04ec0d68e 100644 --- a/tests/tests/Gmagick/EffectsTest.php +++ b/tests/tests/Gmagick/EffectsTest.php @@ -40,7 +40,7 @@ protected function setUpBase() */ public function testColorize() { - $this->isGoingToThrowException('Imagine\Exception\RuntimeException'); + $this->isGoingToThrowException('Imagine\Exception\NotSupportedException'); parent::testColorize(); }