PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, 'jpg', 90); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('image/jpeg; charset=binary', $this->getMime($encoder->result)); } public function testProcessPngGd() { $core = imagecreatefromjpeg(__DIR__.'/images/test.jpg'); $encoder = new GdEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, 'png', 90); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('image/png; charset=binary', $this->getMime($encoder->result)); } public function testProcessGifGd() { $core = imagecreatefromjpeg(__DIR__.'/images/test.jpg'); $encoder = new GdEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, 'gif', 90); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('image/gif; charset=binary', $this->getMime($encoder->result)); } /** * @expectedException \Intervention\Image\Exception\NotSupportedException */ public function testProcessTiffGd() { $core = imagecreatefromjpeg(__DIR__.'/images/test.jpg'); $encoder = new GdEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $img = $encoder->process($image, 'tif', 90); $this->assertInstanceOf('Intervention\Image\Image', $img); } public function testProcessUnknownWithMimeGd() { $core = imagecreatefromjpeg(__DIR__.'/images/test.jpg'); $encoder = new GdEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->mime = 'image/jpeg'; $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, null); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('image/jpeg; charset=binary', $this->getMime($encoder->result)); } public function testProcessUnknownGd() { $core = imagecreatefromjpeg(__DIR__.'/images/test.jpg'); $encoder = new GdEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, null); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('image/jpeg; charset=binary', $this->getMime($encoder->result)); } public function testProcessJpegImagick() { $core = $this->getImagickMock('jpeg'); $encoder = new ImagickEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, 'jpg', 90); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('mock-jpeg', $encoder->result); } public function testProcessPngImagick() { $core = $this->getImagickMock('png'); $encoder = new ImagickEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, 'png', 90); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('mock-png', $encoder->result); } public function testProcessGifImagick() { $core = $this->getImagickMock('gif'); $encoder = new ImagickEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, 'gif', 90); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('mock-gif', $encoder->result); } public function testProcessTiffImagick() { $core = $this->getImagickMock('tiff'); $encoder = new ImagickEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, 'tiff', 90); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('mock-tiff', $encoder->result); } public function testProcessUnknownWithMimeImagick() { $core = $this->getImagickMock('jpeg'); $encoder = new ImagickEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->mime = 'image/jpeg'; $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, null); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('mock-jpeg', $encoder->result); } public function testProcessUnknownImagick() { $core = $this->getImagickMock('jpeg'); $encoder = new ImagickEncoder; $image = Mockery::mock('\Intervention\Image\Image'); $image->shouldReceive('getCore')->once()->andReturn($core); $image->shouldReceive('setEncoded')->once()->andReturn($image); $img = $encoder->process($image, null); $this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertEquals('mock-jpeg', $encoder->result); } public function getImagickMock($type) { $imagick = Mockery::mock('Imagick'); $imagick->shouldReceive('setformat')->with($type)->once(); $imagick->shouldReceive('setimageformat')->once(); $imagick->shouldReceive('setcompression')->once(); $imagick->shouldReceive('setimagecompression')->once(); $imagick->shouldReceive('setcompressionquality'); $imagick->shouldReceive('setimagecompressionquality'); $imagick->shouldReceive('setimagebackgroundcolor'); $imagick->shouldReceive('setbackgroundcolor'); $imagick->shouldReceive('mergeimagelayers')->andReturn($imagick); $imagick->shouldReceive('getimagesblob')->once()->andReturn(sprintf('mock-%s', $type)); return $imagick; } public function getMime($data) { $finfo = new finfo(FILEINFO_MIME); return $finfo->buffer($data); } }