2021-02-26 16:16:17 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Class QRImagickTest
|
|
|
|
*
|
|
|
|
* @filesource QRImagickTest.php
|
|
|
|
* @created 04.07.2018
|
|
|
|
* @package chillerlan\QRCodeTest\Output
|
|
|
|
* @author smiley <smiley@chillerlan.net>
|
|
|
|
* @copyright 2018 smiley
|
|
|
|
* @license MIT
|
|
|
|
*
|
2022-07-02 14:01:51 +00:00
|
|
|
* @noinspection PhpUndefinedClassInspection
|
2021-02-26 16:16:17 +00:00
|
|
|
* @noinspection PhpComposerExtensionStubsInspection
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace chillerlan\QRCodeTest\Output;
|
|
|
|
|
|
|
|
use Imagick;
|
2022-07-02 14:01:51 +00:00
|
|
|
use chillerlan\QRCode\{QRCode, QROptions};
|
|
|
|
use chillerlan\QRCode\Output\{QROutputInterface, QRImagick};
|
2021-02-26 16:16:17 +00:00
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* Tests the QRImagick output module
|
|
|
|
*/
|
2021-02-26 16:16:17 +00:00
|
|
|
class QRImagickTest extends QROutputTestAbstract{
|
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
* @internal
|
|
|
|
*/
|
2021-02-26 16:16:17 +00:00
|
|
|
public function setUp():void{
|
|
|
|
|
|
|
|
if(!extension_loaded('imagick')){
|
|
|
|
$this->markTestSkipped('ext-imagick not loaded');
|
2022-07-02 14:01:51 +00:00
|
|
|
|
|
|
|
/** @noinspection PhpUnreachableStatementInspection */
|
2021-02-26 16:16:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
parent::setUp();
|
|
|
|
}
|
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
protected function getOutputInterface(QROptions $options):QROutputInterface{
|
|
|
|
return new QRImagick($options, $this->matrix);
|
|
|
|
}
|
2021-02-26 16:16:17 +00:00
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
public function types():array{
|
|
|
|
return [
|
|
|
|
'imagick' => [QRCode::OUTPUT_IMAGICK],
|
|
|
|
];
|
2021-02-26 16:16:17 +00:00
|
|
|
}
|
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function testSetModuleValues():void{
|
2021-02-26 16:16:17 +00:00
|
|
|
|
|
|
|
$this->options->moduleValues = [
|
|
|
|
// data
|
|
|
|
1024 => '#4A6000',
|
|
|
|
4 => '#ECF9BE',
|
|
|
|
];
|
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
$this->outputInterface = $this->getOutputInterface($this->options);
|
|
|
|
$this->outputInterface->dump();
|
2021-02-26 16:16:17 +00:00
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
$this::assertTrue(true); // tricking the code coverage
|
2021-02-26 16:16:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testOutputGetResource():void{
|
|
|
|
$this->options->returnResource = true;
|
2022-07-02 14:01:51 +00:00
|
|
|
$this->outputInterface = $this->getOutputInterface($this->options);
|
2021-02-26 16:16:17 +00:00
|
|
|
|
|
|
|
$this::assertInstanceOf(Imagick::class, $this->outputInterface->dump());
|
|
|
|
}
|
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
|
2021-02-26 16:16:17 +00:00
|
|
|
}
|