From a823bdc7c44bc63559240b05890e30483857eda4 Mon Sep 17 00:00:00 2001 From: Gijsdev <38570931+gijsdev@users.noreply.github.com> Date: Thu, 16 Sep 2021 00:16:05 +0200 Subject: [PATCH] Add GD AVIF test --- tests/EncoderTest.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/EncoderTest.php b/tests/EncoderTest.php index f04b50a4..f68818df 100644 --- a/tests/EncoderTest.php +++ b/tests/EncoderTest.php @@ -60,7 +60,7 @@ class EncoderTest extends TestCase $this->assertEquals('image/webp; charset=binary', $this->getMime($encoder->result)); } } - + public function testProcessWebpGdWithUnSupportedPalette() { if (function_exists('imagewebp')) { @@ -75,17 +75,18 @@ class EncoderTest extends TestCase } } - - /** - * @expectedException \Intervention\Image\Exception\NotSupportedException - */ public function testProcessAvifGd() { - $core = imagecreatefromjpeg(__DIR__.'/images/test.jpg'); - $encoder = new GdEncoder; - $image = Mockery::mock('\Intervention\Image\Image'); - $img = $encoder->process($image, 'avif', 90); - $this->assertInstanceOf('Intervention\Image\Image', $img); + if (function_exists('imageavif')) { + $core = imagecreatefromjpeg(__DIR__.'/images/test.jpg'); + $encoder = new GdEncoder; + $image = Mockery::mock('\Intervention\Image\Image'); + $image->shouldReceive('getCore')->once()->andReturn($core); + $image->shouldReceive('setEncoded')->once()->andReturn($image); + $img = $encoder->process($image, 'avif', 90); + $this->assertInstanceOf('Intervention\Image\Image', $img); + $this->assertEquals('image/avif; charset=binary', $this->getMime($encoder->result)); + } } /**