QRStringJSONTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Class QRStringJSONTest
  4. *
  5. * @created 11.12.2021
  6. * @author smiley <smiley@chillerlan.net>
  7. * @copyright 2021 smiley
  8. * @license MIT
  9. */
  10. namespace chillerlan\QRCodeTest\Output;
  11. use chillerlan\QRCode\QROptions;
  12. use chillerlan\QRCode\Data\QRMatrix;
  13. use chillerlan\QRCode\Output\{QROutputInterface, QRStringJSON};
  14. use chillerlan\Settings\SettingsContainerInterface;
  15. /**
  16. *
  17. */
  18. final class QRStringJSONTest extends QROutputTestAbstract{
  19. use CssColorModuleValueProviderTrait;
  20. protected function getOutputInterface(
  21. SettingsContainerInterface|QROptions $options,
  22. QRMatrix $matrix
  23. ):QROutputInterface{
  24. return new QRStringJSON($options, $matrix);
  25. }
  26. /**
  27. * @inheritDoc
  28. */
  29. public function testSetModuleValues():void{
  30. $this->options->moduleValues = [
  31. // data
  32. QRMatrix::M_DATA_DARK => '#AAA',
  33. QRMatrix::M_DATA => '#BBB',
  34. ];
  35. $this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
  36. $data = $this->outputInterface->dump();
  37. $this::assertStringContainsString('"layer":"data-dark","value":"#AAA"', $data);
  38. $this::assertStringContainsString('"layer":"data","value":"#BBB"', $data);
  39. }
  40. }