QRMarkupTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * Class QRMarkupTest
  4. *
  5. * @created 24.12.2017
  6. * @author Smiley <smiley@chillerlan.net>
  7. * @copyright 2017 Smiley
  8. * @license MIT
  9. */
  10. namespace chillerlan\QRCodeTest\Output;
  11. use chillerlan\QRCode\{Data\QRMatrix, QRCode, QROptions};
  12. use chillerlan\QRCode\Output\{QROutputInterface, QRMarkup};
  13. /**
  14. * Tests the QRMarkup output module
  15. */
  16. class QRMarkupTest extends QROutputTestAbstract{
  17. /**
  18. * @inheritDoc
  19. * @internal
  20. */
  21. protected function getOutputInterface(QROptions $options):QROutputInterface{
  22. return new QRMarkup($options, $this->matrix);
  23. }
  24. /**
  25. * @inheritDoc
  26. * @internal
  27. */
  28. public function types():array{
  29. return [
  30. 'html' => [QRCode::OUTPUT_MARKUP_HTML],
  31. 'svg' => [QRCode::OUTPUT_MARKUP_SVG],
  32. ];
  33. }
  34. /**
  35. * @inheritDoc
  36. */
  37. public function testSetModuleValues():void{
  38. $this->options->imageBase64 = false;
  39. $this->options->moduleValues = [
  40. // data
  41. QRMatrix::M_DATA | QRMatrix::IS_DARK => '#4A6000',
  42. QRMatrix::M_DATA => '#ECF9BE',
  43. ];
  44. $this->outputInterface = $this->getOutputInterface($this->options);
  45. $data = $this->outputInterface->dump();
  46. $this::assertStringContainsString('#4A6000', $data);
  47. $this::assertStringContainsString('#ECF9BE', $data);
  48. }
  49. }