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