mirror of
https://github.com/Intervention/image.git
synced 2025-08-23 14:02:47 +02:00
Add tests
This commit is contained in:
@@ -23,6 +23,7 @@ use Intervention\Image\Interfaces\ImageInterface;
|
|||||||
use Intervention\Image\Interfaces\ResolutionInterface;
|
use Intervention\Image\Interfaces\ResolutionInterface;
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
use Intervention\Image\Modifiers\GreyscaleModifier;
|
use Intervention\Image\Modifiers\GreyscaleModifier;
|
||||||
|
use Intervention\Image\Origin;
|
||||||
use Intervention\Image\Tests\ImagickTestCase;
|
use Intervention\Image\Tests\ImagickTestCase;
|
||||||
|
|
||||||
final class ImageTest extends ImagickTestCase
|
final class ImageTest extends ImagickTestCase
|
||||||
@@ -96,6 +97,16 @@ final class ImageTest extends ImagickTestCase
|
|||||||
$this->assertEquals(10, $this->image->loops());
|
$this->assertEquals(10, $this->image->loops());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSetGetOrigin(): void
|
||||||
|
{
|
||||||
|
$origin = $this->image->origin();
|
||||||
|
$this->assertInstanceOf(Origin::class, $origin);
|
||||||
|
$this->image->setOrigin(new Origin('test1', 'test2'));
|
||||||
|
$this->assertInstanceOf(Origin::class, $this->image->origin());
|
||||||
|
$this->assertEquals('test1', $this->image->origin()->mimetype());
|
||||||
|
$this->assertEquals('test2', $this->image->origin()->filePath());
|
||||||
|
}
|
||||||
|
|
||||||
public function testRemoveAnimation(): void
|
public function testRemoveAnimation(): void
|
||||||
{
|
{
|
||||||
$this->assertTrue($this->image->isAnimated());
|
$this->assertTrue($this->image->isAnimated());
|
||||||
|
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Tests\Unit;
|
namespace Intervention\Image\Tests\Unit;
|
||||||
|
|
||||||
|
use Intervention\Image\Colors\Rgb\Decoders\HexColorDecoder;
|
||||||
use Intervention\Image\Drivers\Gd\Driver as GdDriver;
|
use Intervention\Image\Drivers\Gd\Driver as GdDriver;
|
||||||
use Intervention\Image\Drivers\Imagick\Driver as ImagickDriver;
|
use Intervention\Image\Drivers\Imagick\Driver as ImagickDriver;
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
@@ -59,4 +60,15 @@ class InputHandlerTest extends BaseTestCase
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testResolveWithoutDriver(): void
|
||||||
|
{
|
||||||
|
$handler = new InputHandler([new HexColorDecoder()]);
|
||||||
|
$result = $handler->handle('fff');
|
||||||
|
$this->assertInstanceOf(ColorInterface::class, $result);
|
||||||
|
|
||||||
|
$handler = new InputHandler([HexColorDecoder::class]);
|
||||||
|
$result = $handler->handle('fff');
|
||||||
|
$this->assertInstanceOf(ColorInterface::class, $result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user