QRMarkupTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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->imageTransparent = false;
  40. $this->options->moduleValues = [
  41. // data
  42. QRMatrix::M_DATA | QRMatrix::IS_DARK => '#4A6000',
  43. QRMatrix::M_DATA => '#ECF9BE',
  44. ];
  45. $this->outputInterface = $this->getOutputInterface($this->options);
  46. $data = $this->outputInterface->dump();
  47. $this::assertStringContainsString('#4A6000', $data);
  48. $this::assertStringContainsString('#ECF9BE', $data);
  49. }
  50. }