1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-29 16:50:07 +02:00

Add tests

This commit is contained in:
Oliver Vogel
2024-01-27 20:19:25 +01:00
parent 2b99dd439c
commit f4641342c3
2 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Tests\Modifiers;
use Intervention\Image\Colors\Rgb\Colorspace;
use Intervention\Image\Exceptions\NotSupportedException;
use Intervention\Image\Interfaces\ColorspaceInterface;
use Intervention\Image\Modifiers\ColorspaceModifier;
use Intervention\Image\Tests\TestCase;
class ColorspaceModifierTest extends TestCase
{
public function testTargetColorspace(): void
{
$modifier = new ColorspaceModifier(new Colorspace());
$this->assertInstanceOf(ColorspaceInterface::class, $modifier->targetColorspace());
$modifier = new ColorspaceModifier('rgb');
$this->assertInstanceOf(ColorspaceInterface::class, $modifier->targetColorspace());
$modifier = new ColorspaceModifier('cmyk');
$this->assertInstanceOf(ColorspaceInterface::class, $modifier->targetColorspace());
$modifier = new ColorspaceModifier('test');
$this->expectException(NotSupportedException::class);
$modifier->targetColorspace();
}
}

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Tests\Modifiers;
use Intervention\Image\Geometry\Rectangle;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SizeInterface;
use Intervention\Image\Modifiers\PadModifier;
use Intervention\Image\Tests\TestCase;
use Mockery;
class PadModifierTest extends TestCase
{
public function testGetCropSize(): void
{
$modifier = new PadModifier(300, 200);
$image = Mockery::mock(ImageInterface::class);
$size = new Rectangle(300, 200);
$image->shouldReceive('size')->andReturn($size);
$this->assertInstanceOf(SizeInterface::class, $modifier->getCropSize($image));
}
}