QRFpdfTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. declare(strict_types=1);
  11. namespace chillerlan\QRCodeTest\Output;
  12. use chillerlan\QRCode\QROptions;
  13. use chillerlan\QRCode\Data\QRMatrix;
  14. use chillerlan\QRCode\Output\{QRFpdf, QROutputInterface};
  15. use chillerlan\QRCodeTest\Traits\RGBArrayModuleValueProviderTrait;
  16. use chillerlan\Settings\SettingsContainerInterface;
  17. use PHPUnit\Framework\Attributes\Test;
  18. use FPDF;
  19. /**
  20. * Tests the QRFpdf output class
  21. */
  22. final class QRFpdfTest extends QROutputTestAbstract{
  23. use RGBArrayModuleValueProviderTrait;
  24. protected function getOutputInterface(
  25. SettingsContainerInterface|QROptions $options,
  26. QRMatrix $matrix,
  27. ):QROutputInterface{
  28. return new QRFpdf($options, $matrix);
  29. }
  30. #[Test]
  31. public function setModuleValues():void{
  32. $this->options->moduleValues = [
  33. // data
  34. QRMatrix::M_DATA_DARK => [0, 0, 0],
  35. QRMatrix::M_DATA => [255, 255, 255],
  36. ];
  37. $this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
  38. $this->outputInterface->dump();
  39. /** @phpstan-ignore-next-line */
  40. $this::assertTrue(true); // tricking the code coverage
  41. }
  42. public function testOutputGetResource():void{
  43. $this->options->returnResource = true;
  44. $this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
  45. $this::assertInstanceOf(FPDF::class, $this->outputInterface->dump());
  46. }
  47. }