1
0
mirror of https://github.com/Intervention/image.git synced 2025-02-23 13:52:20 +01:00
intervention_image/tests/InvertCommandTest.php
2017-09-02 21:24:22 +02:00

34 lines
1.0 KiB
PHP

<?php
use Intervention\Image\Gd\Commands\InvertCommand as InvertGd;
use Intervention\Image\Imagick\Commands\InvertCommand as InvertImagick;
class InvertCommandTest extends PHPUnit_Framework_TestCase
{
public function tearDown()
{
Mockery::close();
}
public function testGd()
{
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$image = Mockery::mock('Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($resource);
$command = new InvertGd([]);
$result = $command->execute($image);
$this->assertTrue($result);
}
public function testImagick()
{
$imagick = Mockery::mock('Imagick');
$imagick->shouldReceive('negateimage')->with(false)->andReturn(true);
$image = Mockery::mock('Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($imagick);
$command = new InvertImagick([]);
$result = $command->execute($image);
$this->assertTrue($result);
}
}