QRFpdfTest.php 1.3 KB

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