diff --git a/src/Drivers/Gd/Driver.php b/src/Drivers/Gd/Driver.php index e6bcfac4..15296463 100644 --- a/src/Drivers/Gd/Driver.php +++ b/src/Drivers/Gd/Driver.php @@ -27,6 +27,7 @@ class Driver extends AbstractDriver * {@inheritdoc} * * @see DriverInterface::checkHealth() + * @codeCoverageIgnore */ public function checkHealth(): void { diff --git a/src/Drivers/Imagick/Driver.php b/src/Drivers/Imagick/Driver.php index 152fa3b0..4c0a412c 100644 --- a/src/Drivers/Imagick/Driver.php +++ b/src/Drivers/Imagick/Driver.php @@ -29,6 +29,7 @@ class Driver extends AbstractDriver * {@inheritdoc} * * @see DriverInterface::checkHealth() + * @codeCoverageIgnore */ public function checkHealth(): void { diff --git a/tests/Drivers/Gd/DriverTest.php b/tests/Drivers/Gd/DriverTest.php new file mode 100644 index 00000000..946a32fb --- /dev/null +++ b/tests/Drivers/Gd/DriverTest.php @@ -0,0 +1,44 @@ +driver = new Driver(); + } + + public function testId(): void + { + $this->assertEquals('GD', $this->driver->id()); + } + + public function testCreateImage(): void + { + $image = $this->driver->createImage(3, 2); + $this->assertInstanceOf(ImageInterface::class, $image); + $this->assertEquals(3, $image->width()); + $this->assertEquals(2, $image->height()); + } + + public function testCreateAnimation(): void + { + $image = $this->driver->createAnimation(function ($animation) { + $animation->add($this->getTestImagePath('red.gif'), .25); + $animation->add($this->getTestImagePath('green.gif'), .25); + })->setLoops(5); + $this->assertInstanceOf(ImageInterface::class, $image); + + $this->assertEquals(16, $image->width()); + $this->assertEquals(16, $image->height()); + $this->assertEquals(5, $image->loops()); + $this->assertEquals(2, $image->count()); + } +} diff --git a/tests/Drivers/Imagick/DriverTest.php b/tests/Drivers/Imagick/DriverTest.php new file mode 100644 index 00000000..e04a7655 --- /dev/null +++ b/tests/Drivers/Imagick/DriverTest.php @@ -0,0 +1,44 @@ +driver = new Driver(); + } + + public function testId(): void + { + $this->assertEquals('Imagick', $this->driver->id()); + } + + public function testCreateImage(): void + { + $image = $this->driver->createImage(3, 2); + $this->assertInstanceOf(ImageInterface::class, $image); + $this->assertEquals(3, $image->width()); + $this->assertEquals(2, $image->height()); + } + + public function testCreateAnimation(): void + { + $image = $this->driver->createAnimation(function ($animation) { + $animation->add($this->getTestImagePath('red.gif'), .25); + $animation->add($this->getTestImagePath('green.gif'), .25); + })->setLoops(5); + $this->assertInstanceOf(ImageInterface::class, $image); + + $this->assertEquals(16, $image->width()); + $this->assertEquals(16, $image->height()); + $this->assertEquals(5, $image->loops()); + $this->assertEquals(2, $image->count()); + } +}