mirror of
https://github.com/Intervention/image.git
synced 2025-08-29 16:50:07 +02:00
Add tests
This commit is contained in:
30
tests/Modifiers/ColorspaceModifierTest.php
Normal file
30
tests/Modifiers/ColorspaceModifierTest.php
Normal 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();
|
||||
}
|
||||
}
|
24
tests/Modifiers/PadModifierTest.php
Normal file
24
tests/Modifiers/PadModifierTest.php
Normal 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));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user