mirror of
https://github.com/Intervention/image.git
synced 2025-08-15 10:23:59 +02:00
check on webp functions before running tests
This commit is contained in:
@@ -48,14 +48,16 @@ class EncoderTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testProcessWebpGd()
|
public function testProcessWebpGd()
|
||||||
{
|
{
|
||||||
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
|
if (function_exists('imagewebp')) {
|
||||||
$encoder = new GdEncoder;
|
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
|
||||||
$image = Mockery::mock('\Intervention\Image\Image');
|
$encoder = new GdEncoder;
|
||||||
$image->shouldReceive('getCore')->once()->andReturn($core);
|
$image = Mockery::mock('\Intervention\Image\Image');
|
||||||
$image->shouldReceive('setEncoded')->once()->andReturn($image);
|
$image->shouldReceive('getCore')->once()->andReturn($core);
|
||||||
$img = $encoder->process($image, 'webp', 90);
|
$image->shouldReceive('setEncoded')->once()->andReturn($image);
|
||||||
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
$img = $encoder->process($image, 'webp', 90);
|
||||||
$this->assertEquals('image/webp; charset=binary', $this->getMime($encoder->result));
|
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
||||||
|
$this->assertEquals('image/webp; charset=binary', $this->getMime($encoder->result));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -85,16 +85,18 @@ class GdSystemTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testMakeFromWebp()
|
public function testMakeFromWebp()
|
||||||
{
|
{
|
||||||
$img = $this->manager()->make('tests/images/test.webp');
|
if (function_exists('imagecreatefromwebp')) {
|
||||||
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
$img = $this->manager()->make('tests/images/test.webp');
|
||||||
$this->assertInternalType('resource', $img->getCore());
|
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
||||||
$this->assertEquals(16, $img->getWidth());
|
$this->assertInternalType('resource', $img->getCore());
|
||||||
$this->assertEquals(16, $img->getHeight());
|
$this->assertEquals(16, $img->getWidth());
|
||||||
$this->assertEquals('image/webp', $img->mime);
|
$this->assertEquals(16, $img->getHeight());
|
||||||
$this->assertEquals('tests/images', $img->dirname);
|
$this->assertEquals('image/webp', $img->mime);
|
||||||
$this->assertEquals('test.webp', $img->basename);
|
$this->assertEquals('tests/images', $img->dirname);
|
||||||
$this->assertEquals('webp', $img->extension);
|
$this->assertEquals('test.webp', $img->basename);
|
||||||
$this->assertEquals('test', $img->filename);
|
$this->assertEquals('webp', $img->extension);
|
||||||
|
$this->assertEquals('test', $img->filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCanvas()
|
public function testCanvas()
|
||||||
@@ -1498,9 +1500,11 @@ class GdSystemTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testEncodeWebp()
|
public function testEncodeWebp()
|
||||||
{
|
{
|
||||||
$img = $this->manager()->make('tests/images/trim.png');
|
if (function_exists('imagewebp')) {
|
||||||
$data = (string) $img->encode('webp');
|
$img = $this->manager()->make('tests/images/trim.png');
|
||||||
$this->assertEquals('image/webp; charset=binary', $this->getMime($data));
|
$data = (string) $img->encode('webp');
|
||||||
|
$this->assertEquals('image/webp; charset=binary', $this->getMime($data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEncodeDataUrl()
|
public function testEncodeDataUrl()
|
||||||
|
Reference in New Issue
Block a user