mirror of
https://github.com/Intervention/image.git
synced 2025-08-01 11:30:16 +02:00
added Image::mime()
This commit is contained in:
@@ -223,6 +223,16 @@ class Image extends File
|
||||
return $this->getSize()->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads mime type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function mime()
|
||||
{
|
||||
return $this->mime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns encoded image data in string conversion
|
||||
*
|
||||
|
@@ -51,6 +51,12 @@ class ImageTest extends PHPUnit_Framework_TestCase
|
||||
$image->filter($demoFilter);
|
||||
}
|
||||
|
||||
public function testMime()
|
||||
{
|
||||
$image = $this->getTestImage();
|
||||
$this->assertEquals('image/png', $image->mime());
|
||||
}
|
||||
|
||||
private function getTestImage()
|
||||
{
|
||||
$size = Mockery::mock('\Intervention\Image\Size', array(800, 600));
|
||||
@@ -60,6 +66,7 @@ class ImageTest extends PHPUnit_Framework_TestCase
|
||||
$command->shouldReceive('getOutput')->andReturn('mock');
|
||||
$driver->shouldReceive('executeCommand')->andReturn($command);
|
||||
$image = new Image($driver, 'mock');
|
||||
$image->mime = 'image/png';
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
Reference in New Issue
Block a user