QRMarkupTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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\Output\{QROutputInterface, QRMarkup};
  15. /**
  16. * Tests the QRMarkup output module
  17. */
  18. class QRMarkupTest extends QROutputTestAbstract{
  19. /**
  20. * @inheritDoc
  21. * @internal
  22. */
  23. protected function getOutputInterface(QROptions $options):QROutputInterface{
  24. return new QRMarkup($options, $this->matrix);
  25. }
  26. /**
  27. * @inheritDoc
  28. * @internal
  29. */
  30. public function types():array{
  31. return [
  32. 'html' => [QRCode::OUTPUT_MARKUP_HTML],
  33. 'svg' => [QRCode::OUTPUT_MARKUP_SVG],
  34. ];
  35. }
  36. /**
  37. * @inheritDoc
  38. */
  39. public function testSetModuleValues():void{
  40. $this->options->moduleValues = [
  41. // data
  42. 1024 => '#4A6000',
  43. 4 => '#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. }