QRImagickTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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\QRCode;
  15. use chillerlan\QRCode\Data\QRMatrix;
  16. use chillerlan\QRCode\Output\QRImagick;
  17. use Imagick;
  18. /**
  19. * Tests the QRImagick output module
  20. */
  21. final class QRImagickTest extends QROutputTestAbstract{
  22. protected string $FQN = QRImagick::class;
  23. protected string $type = QRCode::OUTPUT_IMAGICK;
  24. /**
  25. * @inheritDoc
  26. */
  27. protected function setUp():void{
  28. if(!extension_loaded('imagick')){
  29. $this::markTestSkipped('ext-imagick not loaded');
  30. }
  31. parent::setUp();
  32. }
  33. /**
  34. * @inheritDoc
  35. */
  36. public function testSetModuleValues():void{
  37. $this->options->moduleValues = [
  38. // data
  39. QRMatrix::M_DATA | QRMatrix::IS_DARK => '#4A6000',
  40. QRMatrix::M_DATA => '#ECF9BE',
  41. ];
  42. $this->outputInterface = new $this->FQN($this->options, $this->matrix);
  43. $this->outputInterface->dump();
  44. $this::assertTrue(true); // tricking the code coverage
  45. }
  46. public function testOutputGetResource():void{
  47. $this->options->returnResource = true;
  48. $this->outputInterface = new $this->FQN($this->options, $this->matrix);
  49. $this::assertInstanceOf(Imagick::class, $this->outputInterface->dump());
  50. }
  51. }