mirror of
https://github.com/Intervention/image.git
synced 2025-08-29 16:50:07 +02:00
Added Gd Encoder Test
This commit is contained in:
29
tests/Drivers/Gd/Encoders/PngEncoderTest.php
Normal file
29
tests/Drivers/Gd/Encoders/PngEncoderTest.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Intervention\Image\Tests\Drivers\Gd\Encoders;
|
||||||
|
|
||||||
|
use Intervention\Image\Collection;
|
||||||
|
use Intervention\Image\Drivers\Gd\Encoders\PngEncoder;
|
||||||
|
use Intervention\Image\Drivers\Gd\Frame;
|
||||||
|
use Intervention\Image\Drivers\Gd\Image;
|
||||||
|
use Intervention\Image\Tests\TestCase;
|
||||||
|
use Intervention\MimeSniffer\MimeSniffer;
|
||||||
|
use Intervention\MimeSniffer\Types\ImagePng;
|
||||||
|
|
||||||
|
class PngEncoderTest extends TestCase
|
||||||
|
{
|
||||||
|
protected function getTestImage(): Image
|
||||||
|
{
|
||||||
|
$frame = new Frame(imagecreatetruecolor(3, 2));
|
||||||
|
|
||||||
|
return new Image(new Collection([$frame]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEncode(): void
|
||||||
|
{
|
||||||
|
$image = $this->getTestImage();
|
||||||
|
$encoder = new PngEncoder();
|
||||||
|
$result = $encoder->encode($image);
|
||||||
|
$this->assertTrue(MimeSniffer::createFromString($result)->matches(new ImagePng));
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user