mirror of
https://github.com/Intervention/image.git
synced 2025-08-01 11:30:16 +02:00
Add tests
This commit is contained in:
@@ -27,6 +27,7 @@ class Driver extends AbstractDriver
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DriverInterface::checkHealth()
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function checkHealth(): void
|
||||
{
|
||||
|
@@ -29,6 +29,7 @@ class Driver extends AbstractDriver
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DriverInterface::checkHealth()
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function checkHealth(): void
|
||||
{
|
||||
|
44
tests/Drivers/Gd/DriverTest.php
Normal file
44
tests/Drivers/Gd/DriverTest.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Intervention\Image\Tests\Drivers\Gd;
|
||||
|
||||
use Intervention\Image\Drivers\Gd\Driver;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Tests\TestCase;
|
||||
|
||||
class DriverTest extends TestCase
|
||||
{
|
||||
protected Driver $driver;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->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());
|
||||
}
|
||||
}
|
44
tests/Drivers/Imagick/DriverTest.php
Normal file
44
tests/Drivers/Imagick/DriverTest.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Intervention\Image\Tests\Drivers\Imagick;
|
||||
|
||||
use Intervention\Image\Drivers\Imagick\Driver;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Tests\TestCase;
|
||||
|
||||
class DriverTest extends TestCase
|
||||
{
|
||||
protected Driver $driver;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user