Skip to content

Commit 1f8ecac

Browse files
committed
test: add tests for GDHandler unsupported image type
1 parent 00cf519 commit 1f8ecac

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/system/Images/GDHandlerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,29 +511,29 @@ public function testSaveUnsupportedImageType(): void
511511
{
512512
$this->handler->withFile($this->path);
513513

514-
// Force an invalid image type to ensure proper exception handling
514+
// Force an invalid image type to trigger getImageResource() default case
515515
$image = $this->handler->getFile();
516516
$image->imageType = 9999;
517517

518518
$this->expectException(ImageException::class);
519519
$this->expectExceptionMessage(lang('Images.unsupportedImageCreate'));
520520

521-
// save() should throw an exception instead of fatal error in GD
521+
// save() calls ensureResource() -> getImageResource(), which should throw
522522
$this->handler->save($this->start . 'work/ci-logo.jpg');
523523
}
524524

525525
public function testProcessUnsupportedImageType(): void
526526
{
527527
$this->handler->withFile($this->path);
528528

529-
// Force an invalid image type to trigger getImageResource default case
529+
// Force an invalid image type to trigger getImageResource() default case
530530
$image = $this->handler->getFile();
531531
$image->imageType = 9999;
532532

533533
$this->expectException(ImageException::class);
534-
$this->expectExceptionMessage('Ima');
534+
$this->expectExceptionMessage(lang('Images.unsupportedImageCreate'));
535535

536-
// Calling any process function that triggers ensureResource/createImage
536+
// resize() calls ensureResource() -> getImageResource(), which should throw
537537
$this->handler->resize(10, 10);
538538
}
539539
}

0 commit comments

Comments
 (0)