QRMarkupTest.php 1.3 KB

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