QRFpdfTest.php 1.3 KB

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