QRImagickTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. namespace chillerlan\QRCodeTest\Output;
  13. use Imagick;
  14. use chillerlan\QRCode\{QRCode, Output\QRImagick};
  15. class QRImagickTest extends QROutputTestAbstract{
  16. protected $FQCN = QRImagick::class;
  17. public function setUp():void{
  18. if(!extension_loaded('imagick')){
  19. $this->markTestSkipped('ext-imagick not loaded');
  20. return;
  21. }
  22. parent::setUp();
  23. }
  24. public function testImageOutput(){
  25. $type = QRCode::OUTPUT_IMAGICK;
  26. $this->options->outputType = $type;
  27. $this->setOutputInterface();
  28. $this->outputInterface->dump($this::cachefile.$type);
  29. $img = $this->outputInterface->dump();
  30. $this->assertSame($img, file_get_contents($this::cachefile.$type));
  31. }
  32. public function testSetModuleValues(){
  33. $this->options->moduleValues = [
  34. // data
  35. 1024 => '#4A6000',
  36. 4 => '#ECF9BE',
  37. ];
  38. $this->setOutputInterface()->dump();
  39. $this->assertTrue(true); // tricking the code coverage
  40. }
  41. public function testOutputGetResource():void{
  42. $this->options->returnResource = true;
  43. $this->setOutputInterface();
  44. $this::assertInstanceOf(Imagick::class, $this->outputInterface->dump());
  45. }
  46. }