1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-01 11:30:16 +02:00

Add tests

This commit is contained in:
Oliver Vogel
2024-01-27 13:17:38 +01:00
parent 75bb6c09ff
commit f807ae818a
2 changed files with 76 additions and 0 deletions

View File

@@ -4,7 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Drivers\Gd;
use Intervention\Image\Colors\Rgb\Colorspace;
use Intervention\Image\Colors\Rgb\Decoders\HexColorDecoder;
use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\ColorProcessorInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Tests\TestCase;
@@ -43,4 +47,38 @@ class DriverTest extends TestCase
$this->assertEquals(5, $image->loops());
$this->assertEquals(2, $image->count());
}
public function testHandleInputImage(): void
{
$result = $this->driver->handleInput($this->getTestImagePath('test.jpg'));
$this->assertInstanceOf(ImageInterface::class, $result);
}
public function testHandleInputColor(): void
{
$result = $this->driver->handleInput('ffffff');
$this->assertInstanceOf(ColorInterface::class, $result);
}
public function testHandleInputObjects(): void
{
$result = $this->driver->handleInput('ffffff', [
new HexColorDecoder()
]);
$this->assertInstanceOf(ColorInterface::class, $result);
}
public function testHandleInputClassnames(): void
{
$result = $this->driver->handleInput('ffffff', [
HexColorDecoder::class
]);
$this->assertInstanceOf(ColorInterface::class, $result);
}
public function testColorProcessor(): void
{
$result = $this->driver->colorProcessor(new Colorspace());
$this->assertInstanceOf(ColorProcessorInterface::class, $result);
}
}

View File

@@ -4,7 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Drivers\Imagick;
use Intervention\Image\Colors\Rgb\Colorspace;
use Intervention\Image\Colors\Rgb\Decoders\HexColorDecoder;
use Intervention\Image\Drivers\Imagick\Driver;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\ColorProcessorInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Tests\TestCase;
@@ -43,4 +47,38 @@ class DriverTest extends TestCase
$this->assertEquals(5, $image->loops());
$this->assertEquals(2, $image->count());
}
public function testHandleInputImage(): void
{
$result = $this->driver->handleInput($this->getTestImagePath('test.jpg'));
$this->assertInstanceOf(ImageInterface::class, $result);
}
public function testHandleInputColor(): void
{
$result = $this->driver->handleInput('ffffff');
$this->assertInstanceOf(ColorInterface::class, $result);
}
public function testHandleInputObjects(): void
{
$result = $this->driver->handleInput('ffffff', [
new HexColorDecoder()
]);
$this->assertInstanceOf(ColorInterface::class, $result);
}
public function testHandleInputClassnames(): void
{
$result = $this->driver->handleInput('ffffff', [
HexColorDecoder::class
]);
$this->assertInstanceOf(ColorInterface::class, $result);
}
public function testColorProcessor(): void
{
$result = $this->driver->colorProcessor(new Colorspace());
$this->assertInstanceOf(ColorProcessorInterface::class, $result);
}
}