mirror of
https://github.com/Intervention/image.git
synced 2025-08-01 11:30:16 +02:00
Add tests
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user