diff --git a/src/Decoders/NativeObjectDecoder.php b/src/Decoders/NativeObjectDecoder.php new file mode 100644 index 00000000..ff83cd95 --- /dev/null +++ b/src/Decoders/NativeObjectDecoder.php @@ -0,0 +1,11 @@ +assertInstanceOf(Image::class, $result); } + public function testHandleGdImage(): void + { + $handler = new InputHandler(); + $result = $handler->handle(imagecreatetruecolor(3, 2)); + $this->assertInstanceOf(Image::class, $result); + } + public function testHandleSplFileInfo(): void { $handler = new InputHandler(); diff --git a/tests/Unit/Drivers/Imagick/InputHandlerTest.php b/tests/Unit/Drivers/Imagick/InputHandlerTest.php index 16449d4e..1b4fbf39 100644 --- a/tests/Unit/Drivers/Imagick/InputHandlerTest.php +++ b/tests/Unit/Drivers/Imagick/InputHandlerTest.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Intervention\Image\Tests\Unit\Drivers\Imagick; +use Imagick; +use ImagickPixel; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Intervention\Image\Colors\Cmyk\Color as CmykColor; @@ -34,6 +36,15 @@ final class InputHandlerTest extends BaseTestCase $this->assertInstanceOf(Image::class, $result); } + public function testHandleImagick(): void + { + $imagick = new Imagick(); + $imagick->newImage(3, 2, new ImagickPixel('rgba(255, 255, 255, 255)'), 'png'); + $handler = new InputHandler(); + $result = $handler->handle($imagick); + $this->assertInstanceOf(Image::class, $result); + } + public function testHandleSplFileInfo(): void { $handler = new InputHandler();