Skip to content

Commit 7856817

Browse files
committed
test: apply reviewer suggestions for GDHandler test skips and exceptions
1 parent f1a40c8 commit 7856817

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎tests/system/Images/GDHandlerTest.php‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CodeIgniter\Images;
1515

16+
use Throwable;
1617
use CodeIgniter\Config\Services;
1718
use CodeIgniter\Images\Exceptions\ImageException;
1819
use CodeIgniter\Images\Handlers\BaseHandler;
@@ -469,7 +470,7 @@ public function testSaveFailed(): void
469470
{
470471
foreach (['gif', 'jpeg', 'png', 'webp'] as $type) {
471472
if ($type === 'webp' && ! function_exists('imagecreatefromwebp')) {
472-
continue; // Skip if not supported
473+
$this->markTestSkipped('webp is not supported.');
473474
}
474475

475476
$this->handler->withFile($this->origin . 'ci-logo.' . $type);
@@ -478,7 +479,8 @@ public function testSaveFailed(): void
478479
try {
479480
$this->handler->save($this->start . 'wontwork/ci-logo.' . $type);
480481
$this->fail('Exception should have been thrown for ' . $type);
481-
} catch (ImageException $e) {
482+
} catch (Throwable $e) {
483+
$this->assertInstanceOf(ImageException::class, $e);
482484
$this->assertSame(lang('Images.saveFailed'), $e->getMessage());
483485
}
484486
}
@@ -488,7 +490,7 @@ public function testImageCopyTargetWithMaxQuality(): void
488490
{
489491
foreach (['gif', 'jpeg', 'png', 'webp'] as $type) {
490492
if ($type === 'webp' && ! function_exists('imagecreatefromwebp')) {
491-
continue;
493+
$this->markTestSkipped('webp is not supported.');
492494
}
493495

494496
$this->handler->withFile($this->origin . 'ci-logo.' . $type);

0 commit comments

Comments
 (0)