1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-23 05:52:47 +02:00

Add tests

This commit is contained in:
Oliver Vogel
2024-05-20 10:30:14 +02:00
parent 25058825c2
commit 7b8b9e1e93
2 changed files with 23 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ResolutionInterface;
use Intervention\Image\Interfaces\SizeInterface;
use Intervention\Image\Modifiers\GreyscaleModifier;
use Intervention\Image\Origin;
use Intervention\Image\Tests\ImagickTestCase;
final class ImageTest extends ImagickTestCase
@@ -96,6 +97,16 @@ final class ImageTest extends ImagickTestCase
$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
{
$this->assertTrue($this->image->isAnimated());

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Unit;
use Intervention\Image\Colors\Rgb\Decoders\HexColorDecoder;
use Intervention\Image\Drivers\Gd\Driver as GdDriver;
use Intervention\Image\Drivers\Imagick\Driver as ImagickDriver;
use Intervention\Image\Exceptions\DecoderException;
@@ -59,4 +60,15 @@ class InputHandlerTest extends BaseTestCase
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);
}
}