mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 12:18:14 +01:00
add test unit
This commit is contained in:
parent
ab55fbb040
commit
dcae042e71
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Intervention\Image\Image;
|
||||
use Intervention\Image\ImageManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ImageTest extends TestCase
|
||||
@ -44,6 +45,25 @@ class ImageTest extends TestCase
|
||||
@unlink($save_as);
|
||||
}
|
||||
|
||||
public function testFormatSave()
|
||||
{
|
||||
$save_as = __DIR__.'/tmp/test';
|
||||
|
||||
$config = ['driver' => new Intervention\Image\Imagick\Driver()];
|
||||
$manager = new ImageManager($config);
|
||||
|
||||
$image = $manager->make('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
|
||||
$this->assertInstanceOf('Intervention\Image\Image', $image);
|
||||
$this->assertInstanceOf('Imagick', $image->getCore());
|
||||
|
||||
$gifCore = $image->getCore();
|
||||
$this->assertEquals($gifCore->getImageMimeType(), 'image/gif');
|
||||
$image->save($save_as, null, 'jpg');
|
||||
|
||||
$this->assertEquals(\mime_content_type($save_as), 'image/jpeg');
|
||||
@unlink($save_as);
|
||||
}
|
||||
|
||||
public function testIsEncoded()
|
||||
{
|
||||
$image = $this->getTestImage();
|
||||
|
Loading…
x
Reference in New Issue
Block a user