1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 20:28:21 +01:00
intervention_image/tests/DriverTest.php
Oliver Vogel 9bb6b213c2 v2
2014-05-10 20:35:01 +02:00

61 lines
1.9 KiB
PHP

<?php
use Intervention\Image\Gd\Driver as GdDriver;
use Intervention\Image\Imagick\Driver as ImagickDriver;
class DriverTest extends PHPUnit_Framework_TestCase
{
public function tearDown()
{
Mockery::close();
}
public function testNewImageGd()
{
$driver = new GdDriver(
Mockery::mock('\Intervention\Image\Gd\Source'),
Mockery::mock('\Intervention\Image\Gd\Encoder')
);
$image = $driver->newImage(300, 200, '00ff00');
$this->assertInstanceOf('\Intervention\Image\Image', $image);
$this->assertInstanceOf('\Intervention\Image\Gd\Driver', $image->getDriver());
$this->assertInternalType('resource', $image->getCore());
}
public function testNewImageImagick()
{
$driver = new ImagickDriver(
Mockery::mock('\Intervention\Image\Imagick\Source'),
Mockery::mock('\Intervention\Image\Imagick\Encoder')
);
$image = $driver->newImage(300, 200, '00ff00');
$this->assertInstanceOf('\Intervention\Image\Image', $image);
$this->assertInstanceOf('\Intervention\Image\Imagick\Driver', $image->getDriver());
$this->assertInstanceOf('\Imagick', $image->getCore());
}
public function testParseColorGd()
{
$driver = new GdDriver(
Mockery::mock('\Intervention\Image\Gd\Source'),
Mockery::mock('\Intervention\Image\Gd\Encoder')
);
$color = $driver->parseColor('00ff00');
$this->assertInstanceOf('\Intervention\Image\Gd\Color', $color);
}
public function testParseColorImagick()
{
$driver = new ImagickDriver(
Mockery::mock('\Intervention\Image\Imagick\Source'),
Mockery::mock('\Intervention\Image\Imagick\Encoder')
);
$color = $driver->parseColor('00ff00');
$this->assertInstanceOf('\Intervention\Image\Imagick\Color', $color);
}
}