mirror of
https://github.com/Intervention/image.git
synced 2025-08-21 05:01:20 +02:00
Rename test functions
This commit is contained in:
@@ -11,14 +11,14 @@ use Mockery\Adapter\Phpunit\MockeryTestCase;
|
|||||||
|
|
||||||
abstract class BaseTestCase extends MockeryTestCase
|
abstract class BaseTestCase extends MockeryTestCase
|
||||||
{
|
{
|
||||||
public function getTestImagePath($filename = 'test.jpg'): string
|
public function getTestResourcePath($filename = 'test.jpg'): string
|
||||||
{
|
{
|
||||||
return sprintf('%s/resources/%s', __DIR__, $filename);
|
return sprintf('%s/resources/%s', __DIR__, $filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTestImageData($filename = 'test.jpg'): string
|
public function getTestResourceData($filename = 'test.jpg'): string
|
||||||
{
|
{
|
||||||
return file_get_contents($this->getTestImagePath($filename));
|
return file_get_contents($this->getTestResourcePath($filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function assertColor($r, $g, $b, $a, ColorInterface $color)
|
protected function assertColor($r, $g, $b, $a, ColorInterface $color)
|
||||||
|
@@ -15,7 +15,7 @@ abstract class GdTestCase extends BaseTestCase
|
|||||||
public function readTestImage($filename = 'test.jpg'): Image
|
public function readTestImage($filename = 'test.jpg'): Image
|
||||||
{
|
{
|
||||||
return (new FilePathImageDecoder())->handle(
|
return (new FilePathImageDecoder())->handle(
|
||||||
$this->getTestImagePath($filename)
|
$this->getTestResourcePath($filename)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ abstract class ImagickTestCase extends BaseTestCase
|
|||||||
public function readTestImage($filename = 'test.jpg'): Image
|
public function readTestImage($filename = 'test.jpg'): Image
|
||||||
{
|
{
|
||||||
return (new FilePathImageDecoder())->handle(
|
return (new FilePathImageDecoder())->handle(
|
||||||
$this->getTestImagePath($filename)
|
$this->getTestResourcePath($filename)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,21 +54,21 @@ final class AbstractDecoderTest extends BaseTestCase
|
|||||||
public function testIsGifFormat(): void
|
public function testIsGifFormat(): void
|
||||||
{
|
{
|
||||||
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
||||||
$this->assertFalse($decoder->isGifFormat($this->getTestImageData('exif.jpg')));
|
$this->assertFalse($decoder->isGifFormat($this->getTestResourceData('exif.jpg')));
|
||||||
$this->assertTrue($decoder->isGifFormat($this->getTestImageData('red.gif')));
|
$this->assertTrue($decoder->isGifFormat($this->getTestResourceData('red.gif')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsFile(): void
|
public function testIsFile(): void
|
||||||
{
|
{
|
||||||
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
||||||
$this->assertTrue($decoder->isFile($this->getTestImagePath()));
|
$this->assertTrue($decoder->isFile($this->getTestResourcePath()));
|
||||||
$this->assertFalse($decoder->isFile('non-existent-file'));
|
$this->assertFalse($decoder->isFile('non-existent-file'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testExtractExifDataFromBinary(): void
|
public function testExtractExifDataFromBinary(): void
|
||||||
{
|
{
|
||||||
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
||||||
$result = $decoder->extractExifData($this->getTestImageData('exif.jpg'));
|
$result = $decoder->extractExifData($this->getTestResourceData('exif.jpg'));
|
||||||
$this->assertInstanceOf(CollectionInterface::class, $result);
|
$this->assertInstanceOf(CollectionInterface::class, $result);
|
||||||
$this->assertEquals('Oliver Vogel', $result->get('IFD0.Artist'));
|
$this->assertEquals('Oliver Vogel', $result->get('IFD0.Artist'));
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ final class AbstractDecoderTest extends BaseTestCase
|
|||||||
public function testExtractExifDataFromPath(): void
|
public function testExtractExifDataFromPath(): void
|
||||||
{
|
{
|
||||||
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
||||||
$result = $decoder->extractExifData($this->getTestImagePath('exif.jpg'));
|
$result = $decoder->extractExifData($this->getTestResourcePath('exif.jpg'));
|
||||||
$this->assertInstanceOf(CollectionInterface::class, $result);
|
$this->assertInstanceOf(CollectionInterface::class, $result);
|
||||||
$this->assertEquals('Oliver Vogel', $result->get('IFD0.Artist'));
|
$this->assertEquals('Oliver Vogel', $result->get('IFD0.Artist'));
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@ final class ClonerTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
public function testClone(): void
|
public function testClone(): void
|
||||||
{
|
{
|
||||||
$gd = imagecreatefromgif($this->getTestImagePath('gradient.gif'));
|
$gd = imagecreatefromgif($this->getTestResourcePath('gradient.gif'));
|
||||||
$clone = Cloner::clone($gd);
|
$clone = Cloner::clone($gd);
|
||||||
|
|
||||||
$this->assertEquals(16, imagesx($gd));
|
$this->assertEquals(16, imagesx($gd));
|
||||||
@@ -29,7 +29,7 @@ final class ClonerTest extends BaseTestCase
|
|||||||
|
|
||||||
public function testCloneEmpty(): void
|
public function testCloneEmpty(): void
|
||||||
{
|
{
|
||||||
$gd = imagecreatefromgif($this->getTestImagePath('gradient.gif'));
|
$gd = imagecreatefromgif($this->getTestResourcePath('gradient.gif'));
|
||||||
$clone = Cloner::cloneEmpty($gd, new Rectangle(12, 12), new Color(255, 0, 0, 0));
|
$clone = Cloner::cloneEmpty($gd, new Rectangle(12, 12), new Color(255, 0, 0, 0));
|
||||||
|
|
||||||
$this->assertEquals(16, imagesx($gd));
|
$this->assertEquals(16, imagesx($gd));
|
||||||
@@ -50,7 +50,7 @@ final class ClonerTest extends BaseTestCase
|
|||||||
|
|
||||||
public function testCLoneBlended(): void
|
public function testCLoneBlended(): void
|
||||||
{
|
{
|
||||||
$gd = imagecreatefromgif($this->getTestImagePath('gradient.gif'));
|
$gd = imagecreatefromgif($this->getTestResourcePath('gradient.gif'));
|
||||||
$clone = Cloner::cloneBlended($gd, new Color(255, 0, 255, 255));
|
$clone = Cloner::cloneBlended($gd, new Color(255, 0, 255, 255));
|
||||||
|
|
||||||
$this->assertEquals(16, imagesx($gd));
|
$this->assertEquals(16, imagesx($gd));
|
||||||
|
@@ -13,12 +13,12 @@ final class AbstractDecoderTest extends BaseTestCase
|
|||||||
public function testGetMediaTypeFromFilePath(): void
|
public function testGetMediaTypeFromFilePath(): void
|
||||||
{
|
{
|
||||||
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
||||||
$this->assertEquals('image/jpeg', $decoder->getMediaTypeByFilePath($this->getTestImagePath('test.jpg')));
|
$this->assertEquals('image/jpeg', $decoder->getMediaTypeByFilePath($this->getTestResourcePath('test.jpg')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetMediaTypeFromFileBinary(): void
|
public function testGetMediaTypeFromFileBinary(): void
|
||||||
{
|
{
|
||||||
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
|
||||||
$this->assertEquals('image/jpeg', $decoder->getMediaTypeByBinary($this->getTestImageData('test.jpg')));
|
$this->assertEquals('image/jpeg', $decoder->getMediaTypeByBinary($this->getTestResourceData('test.jpg')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ final class Base64ImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecode(): void
|
public function testDecode(): void
|
||||||
{
|
{
|
||||||
$result = $this->decoder->decode(
|
$result = $this->decoder->decode(
|
||||||
base64_encode($this->getTestImageData('blue.gif'))
|
base64_encode($this->getTestResourceData('blue.gif'))
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
|
@@ -17,7 +17,7 @@ final class BinaryImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecodePng(): void
|
public function testDecodePng(): void
|
||||||
{
|
{
|
||||||
$decoder = new BinaryImageDecoder();
|
$decoder = new BinaryImageDecoder();
|
||||||
$image = $decoder->decode(file_get_contents($this->getTestImagePath('tile.png')));
|
$image = $decoder->decode(file_get_contents($this->getTestResourcePath('tile.png')));
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
$this->assertEquals(16, $image->width());
|
$this->assertEquals(16, $image->width());
|
||||||
$this->assertEquals(16, $image->height());
|
$this->assertEquals(16, $image->height());
|
||||||
@@ -27,7 +27,7 @@ final class BinaryImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecodeGif(): void
|
public function testDecodeGif(): void
|
||||||
{
|
{
|
||||||
$decoder = new BinaryImageDecoder();
|
$decoder = new BinaryImageDecoder();
|
||||||
$image = $decoder->decode(file_get_contents($this->getTestImagePath('red.gif')));
|
$image = $decoder->decode(file_get_contents($this->getTestResourcePath('red.gif')));
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
$this->assertEquals(16, $image->width());
|
$this->assertEquals(16, $image->width());
|
||||||
$this->assertEquals(16, $image->height());
|
$this->assertEquals(16, $image->height());
|
||||||
@@ -37,7 +37,7 @@ final class BinaryImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecodeAnimatedGif(): void
|
public function testDecodeAnimatedGif(): void
|
||||||
{
|
{
|
||||||
$decoder = new BinaryImageDecoder();
|
$decoder = new BinaryImageDecoder();
|
||||||
$image = $decoder->decode(file_get_contents($this->getTestImagePath('cats.gif')));
|
$image = $decoder->decode(file_get_contents($this->getTestResourcePath('cats.gif')));
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
$this->assertEquals(75, $image->width());
|
$this->assertEquals(75, $image->width());
|
||||||
$this->assertEquals(50, $image->height());
|
$this->assertEquals(50, $image->height());
|
||||||
@@ -47,7 +47,7 @@ final class BinaryImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecodeJpegWithExif(): void
|
public function testDecodeJpegWithExif(): void
|
||||||
{
|
{
|
||||||
$decoder = new BinaryImageDecoder();
|
$decoder = new BinaryImageDecoder();
|
||||||
$image = $decoder->decode(file_get_contents($this->getTestImagePath('exif.jpg')));
|
$image = $decoder->decode(file_get_contents($this->getTestResourcePath('exif.jpg')));
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
$this->assertEquals(16, $image->width());
|
$this->assertEquals(16, $image->width());
|
||||||
$this->assertEquals(16, $image->height());
|
$this->assertEquals(16, $image->height());
|
||||||
|
@@ -26,7 +26,7 @@ final class DataUriImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecode(): void
|
public function testDecode(): void
|
||||||
{
|
{
|
||||||
$result = $this->decoder->decode(
|
$result = $this->decoder->decode(
|
||||||
sprintf('data:image/jpeg;base64,%s', base64_encode($this->getTestImageData('blue.gif')))
|
sprintf('data:image/jpeg;base64,%s', base64_encode($this->getTestResourceData('blue.gif')))
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
|
@@ -26,7 +26,7 @@ final class FilePathImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecode(): void
|
public function testDecode(): void
|
||||||
{
|
{
|
||||||
$result = $this->decoder->decode(
|
$result = $this->decoder->decode(
|
||||||
$this->getTestImagePath()
|
$this->getTestResourcePath()
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
|
@@ -17,7 +17,7 @@ final class FilePointerImageDecoderTest extends GdTestCase
|
|||||||
public function testDecode(): void
|
public function testDecode(): void
|
||||||
{
|
{
|
||||||
$decoder = new FilePointerImageDecoder();
|
$decoder = new FilePointerImageDecoder();
|
||||||
$fp = fopen($this->getTestImagePath('test.jpg'), 'r');
|
$fp = fopen($this->getTestResourcePath('test.jpg'), 'r');
|
||||||
$result = $decoder->decode($fp);
|
$result = $decoder->decode($fp);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ final class SplFileInfoImageDecoderTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
$decoder = new SplFileInfoImageDecoder();
|
$decoder = new SplFileInfoImageDecoder();
|
||||||
$result = $decoder->decode(
|
$result = $decoder->decode(
|
||||||
new SplFileInfo($this->getTestImagePath('blue.gif'))
|
new SplFileInfo($this->getTestResourcePath('blue.gif'))
|
||||||
);
|
);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
|
@@ -37,8 +37,8 @@ final class DriverTest extends BaseTestCase
|
|||||||
public function testCreateAnimation(): void
|
public function testCreateAnimation(): void
|
||||||
{
|
{
|
||||||
$image = $this->driver->createAnimation(function ($animation) {
|
$image = $this->driver->createAnimation(function ($animation) {
|
||||||
$animation->add($this->getTestImagePath('red.gif'), .25);
|
$animation->add($this->getTestResourcePath('red.gif'), .25);
|
||||||
$animation->add($this->getTestImagePath('green.gif'), .25);
|
$animation->add($this->getTestResourcePath('green.gif'), .25);
|
||||||
})->setLoops(5);
|
})->setLoops(5);
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ final class DriverTest extends BaseTestCase
|
|||||||
|
|
||||||
public function testHandleInputImage(): void
|
public function testHandleInputImage(): void
|
||||||
{
|
{
|
||||||
$result = $this->driver->handleInput($this->getTestImagePath('test.jpg'));
|
$result = $this->driver->handleInput($this->getTestResourcePath('test.jpg'));
|
||||||
$this->assertInstanceOf(ImageInterface::class, $result);
|
$this->assertInstanceOf(ImageInterface::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ final class InputHandlerTest extends BaseTestCase
|
|||||||
public function testHandleBinaryImage(): void
|
public function testHandleBinaryImage(): void
|
||||||
{
|
{
|
||||||
$handler = new InputHandler();
|
$handler = new InputHandler();
|
||||||
$input = file_get_contents($this->getTestImagePath('test.jpg'));
|
$input = file_get_contents($this->getTestResourcePath('test.jpg'));
|
||||||
$result = $handler->handle($input);
|
$result = $handler->handle($input);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ final class InputHandlerTest extends BaseTestCase
|
|||||||
public function testHandleSplFileInfo(): void
|
public function testHandleSplFileInfo(): void
|
||||||
{
|
{
|
||||||
$handler = new InputHandler();
|
$handler = new InputHandler();
|
||||||
$input = new SplFileInfo($this->getTestImagePath('test.jpg'));
|
$input = new SplFileInfo($this->getTestResourcePath('test.jpg'));
|
||||||
$result = $handler->handle($input);
|
$result = $handler->handle($input);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ final class InputHandlerTest extends BaseTestCase
|
|||||||
public function testHandleFilePathImage(): void
|
public function testHandleFilePathImage(): void
|
||||||
{
|
{
|
||||||
$handler = new InputHandler();
|
$handler = new InputHandler();
|
||||||
$input = $this->getTestImagePath('animation.gif');
|
$input = $this->getTestResourcePath('animation.gif');
|
||||||
$result = $handler->handle($input);
|
$result = $handler->handle($input);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ final class InputHandlerTest extends BaseTestCase
|
|||||||
public function testHandleBase64Image(): void
|
public function testHandleBase64Image(): void
|
||||||
{
|
{
|
||||||
$handler = new InputHandler();
|
$handler = new InputHandler();
|
||||||
$input = base64_encode(file_get_contents($this->getTestImagePath('animation.gif')));
|
$input = base64_encode(file_get_contents($this->getTestResourcePath('animation.gif')));
|
||||||
$result = $handler->handle($input);
|
$result = $handler->handle($input);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ final class PlaceModifierTest extends GdTestCase
|
|||||||
{
|
{
|
||||||
$image = $this->readTestImage('test.jpg');
|
$image = $this->readTestImage('test.jpg');
|
||||||
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
||||||
$image->modify(new PlaceModifier($this->getTestImagePath('circle.png'), 'top-right', 0, 0));
|
$image->modify(new PlaceModifier($this->getTestResourcePath('circle.png'), 'top-right', 0, 0));
|
||||||
$this->assertEquals('32250d', $image->pickColor(300, 25)->toHex());
|
$this->assertEquals('32250d', $image->pickColor(300, 25)->toHex());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ final class PlaceModifierTest extends GdTestCase
|
|||||||
{
|
{
|
||||||
$image = $this->readTestImage('test.jpg');
|
$image = $this->readTestImage('test.jpg');
|
||||||
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
||||||
$image->modify(new PlaceModifier($this->getTestImagePath('circle.png'), 'top-right', 0, 0, 50));
|
$image->modify(new PlaceModifier($this->getTestResourcePath('circle.png'), 'top-right', 0, 0, 50));
|
||||||
$this->assertEquals('987028', $image->pickColor(300, 25)->toHex());
|
$this->assertEquals('987028', $image->pickColor(300, 25)->toHex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@ final class CanDecodeGifTest extends BaseTestCase
|
|||||||
use CanDecodeGif;
|
use CanDecodeGif;
|
||||||
})->makePartial();
|
})->makePartial();
|
||||||
|
|
||||||
$result = $decoder->decodeGif($this->getTestImageData('animation.gif'));
|
$result = $decoder->decodeGif($this->getTestResourceData('animation.gif'));
|
||||||
$this->assertInstanceOf(ImageInterface::class, $result);
|
$this->assertInstanceOf(ImageInterface::class, $result);
|
||||||
$this->assertEquals('image/gif', $result->origin()->mediaType());
|
$this->assertEquals('image/gif', $result->origin()->mediaType());
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ final class CanDecodeGifTest extends BaseTestCase
|
|||||||
use CanDecodeGif;
|
use CanDecodeGif;
|
||||||
})->makePartial();
|
})->makePartial();
|
||||||
|
|
||||||
$result = $decoder->decodeGif($this->getTestImageData('red.gif'));
|
$result = $decoder->decodeGif($this->getTestResourceData('red.gif'));
|
||||||
$this->assertInstanceOf(ImageInterface::class, $result);
|
$this->assertInstanceOf(ImageInterface::class, $result);
|
||||||
$this->assertEquals('image/gif', $result->origin()->mediaType());
|
$this->assertEquals('image/gif', $result->origin()->mediaType());
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ final class CanDecodeGifTest extends BaseTestCase
|
|||||||
use CanDecodeGif;
|
use CanDecodeGif;
|
||||||
})->makePartial();
|
})->makePartial();
|
||||||
|
|
||||||
$result = $decoder->decodeGif($this->getTestImagePath('animation.gif'));
|
$result = $decoder->decodeGif($this->getTestResourcePath('animation.gif'));
|
||||||
$this->assertInstanceOf(ImageInterface::class, $result);
|
$this->assertInstanceOf(ImageInterface::class, $result);
|
||||||
$this->assertEquals('image/gif', $result->origin()->mediaType());
|
$this->assertEquals('image/gif', $result->origin()->mediaType());
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ final class CanDecodeGifTest extends BaseTestCase
|
|||||||
use CanDecodeGif;
|
use CanDecodeGif;
|
||||||
})->makePartial();
|
})->makePartial();
|
||||||
|
|
||||||
$result = $decoder->decodeGif($this->getTestImagePath('red.gif'));
|
$result = $decoder->decodeGif($this->getTestResourcePath('red.gif'));
|
||||||
$this->assertInstanceOf(ImageInterface::class, $result);
|
$this->assertInstanceOf(ImageInterface::class, $result);
|
||||||
$this->assertEquals('image/gif', $result->origin()->mediaType());
|
$this->assertEquals('image/gif', $result->origin()->mediaType());
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ final class Base64ImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecode(): void
|
public function testDecode(): void
|
||||||
{
|
{
|
||||||
$result = $this->decoder->decode(
|
$result = $this->decoder->decode(
|
||||||
base64_encode($this->getTestImageData('blue.gif'))
|
base64_encode($this->getTestResourceData('blue.gif'))
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
|
@@ -17,7 +17,7 @@ final class BinaryImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecodePng(): void
|
public function testDecodePng(): void
|
||||||
{
|
{
|
||||||
$decoder = new BinaryImageDecoder();
|
$decoder = new BinaryImageDecoder();
|
||||||
$image = $decoder->decode(file_get_contents($this->getTestImagePath('tile.png')));
|
$image = $decoder->decode(file_get_contents($this->getTestResourcePath('tile.png')));
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
$this->assertInstanceOf(RgbColorspace::class, $image->colorspace());
|
$this->assertInstanceOf(RgbColorspace::class, $image->colorspace());
|
||||||
$this->assertEquals(16, $image->width());
|
$this->assertEquals(16, $image->width());
|
||||||
@@ -28,7 +28,7 @@ final class BinaryImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecodeGif(): void
|
public function testDecodeGif(): void
|
||||||
{
|
{
|
||||||
$decoder = new BinaryImageDecoder();
|
$decoder = new BinaryImageDecoder();
|
||||||
$image = $decoder->decode(file_get_contents($this->getTestImagePath('red.gif')));
|
$image = $decoder->decode(file_get_contents($this->getTestResourcePath('red.gif')));
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
$this->assertEquals(16, $image->width());
|
$this->assertEquals(16, $image->width());
|
||||||
$this->assertEquals(16, $image->height());
|
$this->assertEquals(16, $image->height());
|
||||||
@@ -38,7 +38,7 @@ final class BinaryImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecodeAnimatedGif(): void
|
public function testDecodeAnimatedGif(): void
|
||||||
{
|
{
|
||||||
$decoder = new BinaryImageDecoder();
|
$decoder = new BinaryImageDecoder();
|
||||||
$image = $decoder->decode(file_get_contents($this->getTestImagePath('cats.gif')));
|
$image = $decoder->decode(file_get_contents($this->getTestResourcePath('cats.gif')));
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
$this->assertEquals(75, $image->width());
|
$this->assertEquals(75, $image->width());
|
||||||
$this->assertEquals(50, $image->height());
|
$this->assertEquals(50, $image->height());
|
||||||
@@ -48,7 +48,7 @@ final class BinaryImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecodeJpegWithExif(): void
|
public function testDecodeJpegWithExif(): void
|
||||||
{
|
{
|
||||||
$decoder = new BinaryImageDecoder();
|
$decoder = new BinaryImageDecoder();
|
||||||
$image = $decoder->decode(file_get_contents($this->getTestImagePath('exif.jpg')));
|
$image = $decoder->decode(file_get_contents($this->getTestResourcePath('exif.jpg')));
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
$this->assertEquals(16, $image->width());
|
$this->assertEquals(16, $image->width());
|
||||||
$this->assertEquals(16, $image->height());
|
$this->assertEquals(16, $image->height());
|
||||||
@@ -59,7 +59,7 @@ final class BinaryImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecodeCmykImage(): void
|
public function testDecodeCmykImage(): void
|
||||||
{
|
{
|
||||||
$decoder = new BinaryImageDecoder();
|
$decoder = new BinaryImageDecoder();
|
||||||
$image = $decoder->decode(file_get_contents($this->getTestImagePath('cmyk.jpg')));
|
$image = $decoder->decode(file_get_contents($this->getTestResourcePath('cmyk.jpg')));
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
$this->assertInstanceOf(CmykColorspace::class, $image->colorspace());
|
$this->assertInstanceOf(CmykColorspace::class, $image->colorspace());
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@ final class DataUriImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecode(): void
|
public function testDecode(): void
|
||||||
{
|
{
|
||||||
$result = $this->decoder->decode(
|
$result = $this->decoder->decode(
|
||||||
sprintf('data:image/jpeg;base64,%s', base64_encode($this->getTestImageData('blue.gif')))
|
sprintf('data:image/jpeg;base64,%s', base64_encode($this->getTestResourceData('blue.gif')))
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
|
@@ -26,7 +26,7 @@ final class FilePathImageDecoderTest extends BaseTestCase
|
|||||||
public function testDecode(): void
|
public function testDecode(): void
|
||||||
{
|
{
|
||||||
$result = $this->decoder->decode(
|
$result = $this->decoder->decode(
|
||||||
$this->getTestImagePath()
|
$this->getTestResourcePath()
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
|
@@ -17,7 +17,7 @@ final class FilePointerImageDecoderTest extends ImagickTestCase
|
|||||||
public function testDecode(): void
|
public function testDecode(): void
|
||||||
{
|
{
|
||||||
$decoder = new FilePointerImageDecoder();
|
$decoder = new FilePointerImageDecoder();
|
||||||
$fp = fopen($this->getTestImagePath('test.jpg'), 'r');
|
$fp = fopen($this->getTestResourcePath('test.jpg'), 'r');
|
||||||
$result = $decoder->decode($fp);
|
$result = $decoder->decode($fp);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ final class SplFileInfoImageDecoderTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
$decoder = new SplFileInfoImageDecoder();
|
$decoder = new SplFileInfoImageDecoder();
|
||||||
$result = $decoder->decode(
|
$result = $decoder->decode(
|
||||||
new SplFileInfo($this->getTestImagePath('blue.gif'))
|
new SplFileInfo($this->getTestResourcePath('blue.gif'))
|
||||||
);
|
);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
|
@@ -37,8 +37,8 @@ final class DriverTest extends BaseTestCase
|
|||||||
public function testCreateAnimation(): void
|
public function testCreateAnimation(): void
|
||||||
{
|
{
|
||||||
$image = $this->driver->createAnimation(function ($animation) {
|
$image = $this->driver->createAnimation(function ($animation) {
|
||||||
$animation->add($this->getTestImagePath('red.gif'), .25);
|
$animation->add($this->getTestResourcePath('red.gif'), .25);
|
||||||
$animation->add($this->getTestImagePath('green.gif'), .25);
|
$animation->add($this->getTestResourcePath('green.gif'), .25);
|
||||||
})->setLoops(5);
|
})->setLoops(5);
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ final class DriverTest extends BaseTestCase
|
|||||||
|
|
||||||
public function testHandleInputImage(): void
|
public function testHandleInputImage(): void
|
||||||
{
|
{
|
||||||
$result = $this->driver->handleInput($this->getTestImagePath('test.jpg'));
|
$result = $this->driver->handleInput($this->getTestResourcePath('test.jpg'));
|
||||||
$this->assertInstanceOf(ImageInterface::class, $result);
|
$this->assertInstanceOf(ImageInterface::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ final class ImageTest extends ImagickTestCase
|
|||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$imagick = new Imagick();
|
$imagick = new Imagick();
|
||||||
$imagick->readImage($this->getTestImagePath('animation.gif'));
|
$imagick->readImage($this->getTestResourcePath('animation.gif'));
|
||||||
$this->image = new Image(
|
$this->image = new Image(
|
||||||
new Driver(),
|
new Driver(),
|
||||||
new Core($imagick),
|
new Core($imagick),
|
||||||
|
@@ -29,7 +29,7 @@ final class InputHandlerTest extends BaseTestCase
|
|||||||
public function testHandleBinaryImage(): void
|
public function testHandleBinaryImage(): void
|
||||||
{
|
{
|
||||||
$handler = new InputHandler();
|
$handler = new InputHandler();
|
||||||
$input = file_get_contents($this->getTestImagePath('animation.gif'));
|
$input = file_get_contents($this->getTestResourcePath('animation.gif'));
|
||||||
$result = $handler->handle($input);
|
$result = $handler->handle($input);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ final class InputHandlerTest extends BaseTestCase
|
|||||||
public function testHandleSplFileInfo(): void
|
public function testHandleSplFileInfo(): void
|
||||||
{
|
{
|
||||||
$handler = new InputHandler();
|
$handler = new InputHandler();
|
||||||
$input = new SplFileInfo($this->getTestImagePath('test.jpg'));
|
$input = new SplFileInfo($this->getTestResourcePath('test.jpg'));
|
||||||
$result = $handler->handle($input);
|
$result = $handler->handle($input);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ final class InputHandlerTest extends BaseTestCase
|
|||||||
public function testHandleFilePathImage(): void
|
public function testHandleFilePathImage(): void
|
||||||
{
|
{
|
||||||
$handler = new InputHandler();
|
$handler = new InputHandler();
|
||||||
$input = $this->getTestImagePath('animation.gif');
|
$input = $this->getTestResourcePath('animation.gif');
|
||||||
$result = $handler->handle($input);
|
$result = $handler->handle($input);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ final class InputHandlerTest extends BaseTestCase
|
|||||||
public function testHandleBase64Image(): void
|
public function testHandleBase64Image(): void
|
||||||
{
|
{
|
||||||
$handler = new InputHandler();
|
$handler = new InputHandler();
|
||||||
$input = base64_encode(file_get_contents($this->getTestImagePath('animation.gif')));
|
$input = base64_encode(file_get_contents($this->getTestResourcePath('animation.gif')));
|
||||||
$result = $handler->handle($input);
|
$result = $handler->handle($input);
|
||||||
$this->assertInstanceOf(Image::class, $result);
|
$this->assertInstanceOf(Image::class, $result);
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ final class PlaceModifierTest extends ImagickTestCase
|
|||||||
{
|
{
|
||||||
$image = $this->readTestImage('test.jpg');
|
$image = $this->readTestImage('test.jpg');
|
||||||
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
||||||
$image->modify(new PlaceModifier($this->getTestImagePath('circle.png'), 'top-right', 0, 0));
|
$image->modify(new PlaceModifier($this->getTestResourcePath('circle.png'), 'top-right', 0, 0));
|
||||||
$this->assertEquals('33260e', $image->pickColor(300, 25)->toHex());
|
$this->assertEquals('33260e', $image->pickColor(300, 25)->toHex());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ final class PlaceModifierTest extends ImagickTestCase
|
|||||||
{
|
{
|
||||||
$image = $this->readTestImage('test.jpg');
|
$image = $this->readTestImage('test.jpg');
|
||||||
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
||||||
$image->modify(new PlaceModifier($this->getTestImagePath('circle.png'), 'top-right', 0, 0, 50));
|
$image->modify(new PlaceModifier($this->getTestResourcePath('circle.png'), 'top-right', 0, 0, 50));
|
||||||
$this->assertEquals('987129', $image->pickColor(300, 25)->toHex());
|
$this->assertEquals('987129', $image->pickColor(300, 25)->toHex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
$manager = new ImageManager(GdDriver::class);
|
$manager = new ImageManager(GdDriver::class);
|
||||||
$image = $manager->animate(function ($animation) {
|
$image = $manager->animate(function ($animation) {
|
||||||
$animation->add($this->getTestImagePath('red.gif'), .25);
|
$animation->add($this->getTestResourcePath('red.gif'), .25);
|
||||||
});
|
});
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadGd(): void
|
public function testReadGd(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(GdDriver::class);
|
$manager = new ImageManager(GdDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'));
|
$image = $manager->read($this->getTestResourcePath('red.gif'));
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadGdWithDecoderClassname(): void
|
public function testReadGdWithDecoderClassname(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(GdDriver::class);
|
$manager = new ImageManager(GdDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), FilePathImageDecoder::class);
|
$image = $manager->read($this->getTestResourcePath('red.gif'), FilePathImageDecoder::class);
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadGdWithDecoderInstance(): void
|
public function testReadGdWithDecoderInstance(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(GdDriver::class);
|
$manager = new ImageManager(GdDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), new FilePathImageDecoder());
|
$image = $manager->read($this->getTestResourcePath('red.gif'), new FilePathImageDecoder());
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadGdWithDecoderClassnameArray(): void
|
public function testReadGdWithDecoderClassnameArray(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(GdDriver::class);
|
$manager = new ImageManager(GdDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), [FilePathImageDecoder::class]);
|
$image = $manager->read($this->getTestResourcePath('red.gif'), [FilePathImageDecoder::class]);
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadGdWithDecoderInstanceArray(): void
|
public function testReadGdWithDecoderInstanceArray(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(GdDriver::class);
|
$manager = new ImageManager(GdDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), [new FilePathImageDecoder()]);
|
$image = $manager->read($this->getTestResourcePath('red.gif'), [new FilePathImageDecoder()]);
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadGdWithDecoderInstanceArrayMultiple(): void
|
public function testReadGdWithDecoderInstanceArrayMultiple(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(GdDriver::class);
|
$manager = new ImageManager(GdDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), [
|
$image = $manager->read($this->getTestResourcePath('red.gif'), [
|
||||||
new BinaryImageDecoder(),
|
new BinaryImageDecoder(),
|
||||||
new FilePathImageDecoder(),
|
new FilePathImageDecoder(),
|
||||||
]);
|
]);
|
||||||
@@ -117,7 +117,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadGdWithRotationAdjustment(): void
|
public function testReadGdWithRotationAdjustment(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(GdDriver::class);
|
$manager = new ImageManager(GdDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('orientation.jpg'));
|
$image = $manager->read($this->getTestResourcePath('orientation.jpg'));
|
||||||
$this->assertColor(255, 255, 255, 255, $image->pickColor(0, 24));
|
$this->assertColor(255, 255, 255, 255, $image->pickColor(0, 24));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
$manager = new ImageManager(ImagickDriver::class);
|
$manager = new ImageManager(ImagickDriver::class);
|
||||||
$image = $manager->animate(function ($animation) {
|
$image = $manager->animate(function ($animation) {
|
||||||
$animation->add($this->getTestImagePath('red.gif'), .25);
|
$animation->add($this->getTestResourcePath('red.gif'), .25);
|
||||||
});
|
});
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadImagick(): void
|
public function testReadImagick(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(ImagickDriver::class);
|
$manager = new ImageManager(ImagickDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'));
|
$image = $manager->read($this->getTestResourcePath('red.gif'));
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadImagickWithDecoderClassname(): void
|
public function testReadImagickWithDecoderClassname(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(ImagickDriver::class);
|
$manager = new ImageManager(ImagickDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), FilePathImageDecoder::class);
|
$image = $manager->read($this->getTestResourcePath('red.gif'), FilePathImageDecoder::class);
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadImagickWithDecoderInstance(): void
|
public function testReadImagickWithDecoderInstance(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(ImagickDriver::class);
|
$manager = new ImageManager(ImagickDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), new FilePathImageDecoder());
|
$image = $manager->read($this->getTestResourcePath('red.gif'), new FilePathImageDecoder());
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadImagickWithDecoderClassnameArray(): void
|
public function testReadImagickWithDecoderClassnameArray(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(ImagickDriver::class);
|
$manager = new ImageManager(ImagickDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), [FilePathImageDecoder::class]);
|
$image = $manager->read($this->getTestResourcePath('red.gif'), [FilePathImageDecoder::class]);
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadImagickWithDecoderInstanceArray(): void
|
public function testReadImagickWithDecoderInstanceArray(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(ImagickDriver::class);
|
$manager = new ImageManager(ImagickDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), [new FilePathImageDecoder()]);
|
$image = $manager->read($this->getTestResourcePath('red.gif'), [new FilePathImageDecoder()]);
|
||||||
$this->assertInstanceOf(ImageInterface::class, $image);
|
$this->assertInstanceOf(ImageInterface::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadImagickWithDecoderInstanceArrayMultiple(): void
|
public function testReadImagickWithDecoderInstanceArrayMultiple(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(ImagickDriver::class);
|
$manager = new ImageManager(ImagickDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('red.gif'), [
|
$image = $manager->read($this->getTestResourcePath('red.gif'), [
|
||||||
new BinaryImageDecoder(),
|
new BinaryImageDecoder(),
|
||||||
new FilePathImageDecoder(),
|
new FilePathImageDecoder(),
|
||||||
]);
|
]);
|
||||||
@@ -194,7 +194,7 @@ final class ImageManagerTest extends BaseTestCase
|
|||||||
public function testReadImagickWithRotationAdjustment(): void
|
public function testReadImagickWithRotationAdjustment(): void
|
||||||
{
|
{
|
||||||
$manager = new ImageManager(ImagickDriver::class);
|
$manager = new ImageManager(ImagickDriver::class);
|
||||||
$image = $manager->read($this->getTestImagePath('orientation.jpg'));
|
$image = $manager->read($this->getTestResourcePath('orientation.jpg'));
|
||||||
$this->assertColor(255, 255, 255, 255, $image->pickColor(0, 24));
|
$this->assertColor(255, 255, 255, 255, $image->pickColor(0, 24));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,13 +11,13 @@ final class OriginTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
public function testFilePath(): void
|
public function testFilePath(): void
|
||||||
{
|
{
|
||||||
$origin = new Origin('image/jpeg', $this->getTestImagePath('example.jpg'));
|
$origin = new Origin('image/jpeg', $this->getTestResourcePath('example.jpg'));
|
||||||
$this->assertEquals($this->getTestImagePath('example.jpg'), $origin->filePath());
|
$this->assertEquals($this->getTestResourcePath('example.jpg'), $origin->filePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFileExtension(): void
|
public function testFileExtension(): void
|
||||||
{
|
{
|
||||||
$origin = new Origin('image/jpeg', $this->getTestImagePath('example.jpg'));
|
$origin = new Origin('image/jpeg', $this->getTestResourcePath('example.jpg'));
|
||||||
$this->assertEquals('jpg', $origin->fileExtension());
|
$this->assertEquals('jpg', $origin->fileExtension());
|
||||||
|
|
||||||
$origin = new Origin('image/jpeg');
|
$origin = new Origin('image/jpeg');
|
||||||
|
@@ -39,7 +39,7 @@ final class FontTest extends BaseTestCase
|
|||||||
$font = new Font();
|
$font = new Font();
|
||||||
$this->assertEquals(null, $font->filename());
|
$this->assertEquals(null, $font->filename());
|
||||||
$this->assertFalse($font->hasFilename());
|
$this->assertFalse($font->hasFilename());
|
||||||
$filename = $this->getTestImagePath();
|
$filename = $this->getTestResourcePath();
|
||||||
$result = $font->setFilename($filename);
|
$result = $font->setFilename($filename);
|
||||||
$this->assertTrue($font->hasFilename());
|
$this->assertTrue($font->hasFilename());
|
||||||
$this->assertInstanceOf(Font::class, $result);
|
$this->assertInstanceOf(Font::class, $result);
|
||||||
|
Reference in New Issue
Block a user