mirror of
https://github.com/Intervention/image.git
synced 2025-02-23 13:52:20 +01:00
35 lines
948 B
PHP
35 lines
948 B
PHP
<?php
|
|
|
|
namespace Intervention\Image\Tests\Drivers\Imagick\Encoders;
|
|
|
|
use Imagick;
|
|
use ImagickPixel;
|
|
use Intervention\Image\Drivers\Imagick\Encoders\AvifEncoder;
|
|
use Intervention\Image\Drivers\Imagick\Image;
|
|
use Intervention\Image\Tests\TestCase;
|
|
use Intervention\MimeSniffer\MimeSniffer;
|
|
use Intervention\MimeSniffer\Types\ImageAvif;
|
|
|
|
/**
|
|
* @requires extension imagick
|
|
* @covers \Intervention\Image\Drivers\Imagick\Encoders\AvifEncoder
|
|
*/
|
|
class AvifEncoderTest extends TestCase
|
|
{
|
|
protected function getTestImage(): Image
|
|
{
|
|
$imagick = new Imagick();
|
|
$imagick->newImage(3, 2, new ImagickPixel('red'), 'png');
|
|
|
|
return new Image($imagick);
|
|
}
|
|
|
|
public function testEncode(): void
|
|
{
|
|
$image = $this->getTestImage();
|
|
$encoder = new AvifEncoder(10);
|
|
$result = $encoder->encode($image);
|
|
$this->assertTrue(MimeSniffer::createFromString($result)->matches(new ImageAvif()));
|
|
}
|
|
}
|