@@ -306,8 +306,14 @@ public function testMoreText()
306306
307307 public function testImageCreation ()
308308 {
309- foreach (['gif ' , 'jpeg ' , 'png ' ] as $ type )
309+ foreach (['gif ' , 'jpeg ' , 'png ' , ' webp ' ] as $ type )
310310 {
311+ if ($ type === 'webp ' && ! in_array ('WEBP ' , \Imagick::queryFormats ()))
312+ {
313+ $ this ->expectException (ImageException::class);
314+ $ this ->expectExceptionMessage ('Your server does not support the GD function required to process this type of image. ' );
315+ }
316+
311317 $ this ->handler ->withFile ($ this ->origin . 'ci-logo. ' . $ type );
312318 $ this ->handler ->text ('vertical ' );
313319 $ this ->assertEquals (155 , $ this ->handler ->getWidth ());
@@ -319,7 +325,7 @@ public function testImageCreation()
319325
320326 public function testImageCopy ()
321327 {
322- foreach (['gif ' , 'jpeg ' , 'png ' ] as $ type )
328+ foreach (['gif ' , 'jpeg ' , 'png ' , ' webp ' ] as $ type )
323329 {
324330 $ this ->handler ->withFile ($ this ->origin . 'ci-logo. ' . $ type );
325331 $ this ->handler ->save ($ this ->root . 'ci-logo. ' . $ type );
@@ -334,8 +340,14 @@ public function testImageCopy()
334340
335341 public function testImageCompressionGetResource ()
336342 {
337- foreach (['gif ' , 'jpeg ' , 'png ' ] as $ type )
343+ foreach (['gif ' , 'jpeg ' , 'png ' , ' webp ' ] as $ type )
338344 {
345+ if ($ type === 'webp ' && ! in_array ('WEBP ' , \Imagick::queryFormats ()))
346+ {
347+ $ this ->expectException (ImageException::class);
348+ $ this ->expectExceptionMessage ('Your server does not support the GD function required to process this type of image. ' );
349+ }
350+
339351 $ this ->handler ->withFile ($ this ->origin . 'ci-logo. ' . $ type );
340352 $ this ->handler ->getResource (); // make sure resource is loaded
341353 $ this ->handler ->save ($ this ->root . 'ci-logo. ' . $ type );
@@ -350,8 +362,14 @@ public function testImageCompressionGetResource()
350362
351363 public function testImageCompressionWithResource ()
352364 {
353- foreach (['gif ' , 'jpeg ' , 'png ' ] as $ type )
365+ foreach (['gif ' , 'jpeg ' , 'png ' , ' webp ' ] as $ type )
354366 {
367+ if ($ type === 'webp ' && ! in_array ('WEBP ' , \Imagick::queryFormats ()))
368+ {
369+ $ this ->expectException (ImageException::class);
370+ $ this ->expectExceptionMessage ('Your server does not support the GD function required to process this type of image. ' );
371+ }
372+
355373 $ this ->handler ->withFile ($ this ->origin . 'ci-logo. ' . $ type )
356374 ->withResource () // make sure resource is loaded
357375 ->save ($ this ->root . 'ci-logo. ' . $ type );
0 commit comments