QRImagickTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Class QRImagickTest
  4. *
  5. * @created 04.07.2018
  6. * @author smiley <smiley@chillerlan.net>
  7. * @copyright 2018 smiley
  8. * @license MIT
  9. *
  10. * @noinspection PhpUndefinedClassInspection
  11. * @noinspection PhpComposerExtensionStubsInspection
  12. */
  13. namespace chillerlan\QRCodeTest\Output;
  14. use chillerlan\QRCode\Data\QRMatrix;
  15. use chillerlan\QRCode\Output\{QRImagick, QROutputInterface};
  16. use Imagick;
  17. /**
  18. * Tests the QRImagick output module
  19. */
  20. final class QRImagickTest extends QROutputTestAbstract{
  21. protected string $FQN = QRImagick::class;
  22. protected string $type = QROutputInterface::IMAGICK;
  23. /**
  24. * @inheritDoc
  25. */
  26. protected function setUp():void{
  27. if(!extension_loaded('imagick')){
  28. $this::markTestSkipped('ext-imagick not loaded');
  29. }
  30. parent::setUp();
  31. }
  32. /**
  33. * @inheritDoc
  34. */
  35. public function testSetModuleValues():void{
  36. $this->options->moduleValues = [
  37. // data
  38. QRMatrix::M_DATA | QRMatrix::IS_DARK => '#4A6000',
  39. QRMatrix::M_DATA => '#ECF9BE',
  40. ];
  41. $this->outputInterface = new $this->FQN($this->options, $this->matrix);
  42. $this->outputInterface->dump();
  43. $this::assertTrue(true); // tricking the code coverage
  44. }
  45. public function testOutputGetResource():void{
  46. $this->options->returnResource = true;
  47. $this->outputInterface = new $this->FQN($this->options, $this->matrix);
  48. $this::assertInstanceOf(Imagick::class, $this->outputInterface->dump());
  49. }
  50. }