1
0
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:
Oliver Vogel
2017-07-03 17:04:25 +02:00
parent baeeac5125
commit dccbee2e9d
2 changed files with 27 additions and 21 deletions

View File

@@ -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

View File

@@ -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()
{