| 1 |
<?php |
| 2 |
|
| 3 |
namespace WebPConvert\Tests\Convert\Converters; |
| 4 |
|
| 5 |
use WebPConvert\Convert\Converters\Imagick; |
| 6 |
|
| 7 |
use PHPUnit\Framework\TestCase; |
| 8 |
|
| 9 |
/** |
| 10 |
* @coversDefaultClass WebPConvert\Convert\Converters\Imagick |
| 11 |
* @covers WebPConvert\Convert\Converters\Imagick |
| 12 |
*/ |
| 13 |
class ImagickTest extends TestCase |
| 14 |
{ |
| 15 |
|
| 16 |
public static $imageDir = __DIR__ . '/../../images/'; |
| 17 |
|
| 18 |
public function testConvert() |
| 19 |
{ |
| 20 |
ConverterTestHelper::runAllConvertTests($this, 'Imagick'); |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* @coversNothing |
| 25 |
*/ |
| 26 |
public function testQueryFormats() |
| 27 |
{ |
| 28 |
if (!extension_loaded('imagick')) { |
| 29 |
$this->markTestSkipped( |
| 30 |
'The imagick extension is not available.' |
| 31 |
); |
| 32 |
return; |
| 33 |
} |
| 34 |
//if (!class_exists('\\Imagick')) {} |
| 35 |
|
| 36 |
$im = new \Imagick(); |
| 37 |
|
| 38 |
$this->assertEquals(1, count($im->queryFormats('JPEG'))); |
| 39 |
$this->assertGreaterThan(2, count($im->queryFormats('*'))); |
| 40 |
$this->assertGreaterThan(2, count($im->queryFormats())); |
| 41 |
$this->assertEquals(count($im->queryFormats('*')), count($im->queryFormats())); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* @coversNothing |
| 46 |
*/ |
| 47 |
public function testThatImagickFunctionsUsedDoesNotThrow() |
| 48 |
{ |
| 49 |
if (!extension_loaded('imagick')) { |
| 50 |
$this->markTestSkipped( |
| 51 |
'The imagick extension is not available.' |
| 52 |
); |
| 53 |
return; |
| 54 |
} |
| 55 |
$im = new \Imagick(self::$imageDir . '/test.jpg'); |
| 56 |
$im->setImageFormat('JPEG'); |
| 57 |
$im->stripImage(); |
| 58 |
$im->setImageCompressionQuality(100); |
| 59 |
$imageBlob = $im->getImageBlob(); |
| 60 |
|
| 61 |
$this->addToAssertionCount(1); |
| 62 |
} |
| 63 |
} |
| 64 |
|