QRImagickTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Class QRImagickTest
  4. *
  5. * @filesource QRImagickTest.php
  6. * @created 04.07.2018
  7. * @package chillerlan\QRCodeTest\Output
  8. * @author smiley <smiley@chillerlan.net>
  9. * @copyright 2018 smiley
  10. * @license MIT
  11. *
  12. * @noinspection PhpComposerExtensionStubsInspection
  13. */
  14. namespace chillerlan\QRCodeTest\Output;
  15. use Imagick;
  16. use chillerlan\QRCode\{QRCode, Output\QRImagick};
  17. class QRImagickTest extends QROutputTestAbstract{
  18. protected $FQCN = QRImagick::class;
  19. public function setUp():void{
  20. if(!extension_loaded('imagick')){
  21. $this->markTestSkipped('ext-imagick not loaded');
  22. return;
  23. }
  24. parent::setUp();
  25. }
  26. public function testImageOutput(){
  27. $type = QRCode::OUTPUT_IMAGICK;
  28. $this->options->outputType = $type;
  29. $this->setOutputInterface();
  30. $this->outputInterface->dump($this::cachefile.$type);
  31. $img = $this->outputInterface->dump();
  32. $this->assertSame($img, file_get_contents($this::cachefile.$type));
  33. }
  34. public function testSetModuleValues(){
  35. $this->options->moduleValues = [
  36. // data
  37. 1024 => '#4A6000',
  38. 4 => '#ECF9BE',
  39. ];
  40. $this->setOutputInterface()->dump();
  41. $this->assertTrue(true); // tricking the code coverage
  42. }
  43. public function testOutputGetResource():void{
  44. $this->options->returnResource = true;
  45. $this->setOutputInterface();
  46. $this::assertInstanceOf(Imagick::class, $this->outputInterface->dump());
  47. }
  48. }