mirror of
https://github.com/Intervention/image.git
synced 2025-08-14 01:44:03 +02:00
check on webp functions before running tests
This commit is contained in:
@@ -48,6 +48,7 @@ class EncoderTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessWebpGd()
|
||||
{
|
||||
if (function_exists('imagewebp')) {
|
||||
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
|
||||
$encoder = new GdEncoder;
|
||||
$image = Mockery::mock('\Intervention\Image\Image');
|
||||
@@ -57,6 +58,7 @@ class EncoderTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
||||
$this->assertEquals('image/webp; charset=binary', $this->getMime($encoder->result));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Intervention\Image\Exception\NotSupportedException
|
||||
|
@@ -85,6 +85,7 @@ class GdSystemTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testMakeFromWebp()
|
||||
{
|
||||
if (function_exists('imagecreatefromwebp')) {
|
||||
$img = $this->manager()->make('tests/images/test.webp');
|
||||
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
||||
$this->assertInternalType('resource', $img->getCore());
|
||||
@@ -96,6 +97,7 @@ class GdSystemTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('webp', $img->extension);
|
||||
$this->assertEquals('test', $img->filename);
|
||||
}
|
||||
}
|
||||
|
||||
public function testCanvas()
|
||||
{
|
||||
@@ -1498,10 +1500,12 @@ class GdSystemTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testEncodeWebp()
|
||||
{
|
||||
if (function_exists('imagewebp')) {
|
||||
$img = $this->manager()->make('tests/images/trim.png');
|
||||
$data = (string) $img->encode('webp');
|
||||
$this->assertEquals('image/webp; charset=binary', $this->getMime($data));
|
||||
}
|
||||
}
|
||||
|
||||
public function testEncodeDataUrl()
|
||||
{
|
||||
|
Reference in New Issue
Block a user