QRStringTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Class QRStringTest
  4. *
  5. * @filesource QRStringTest.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, QRString};
  15. /**
  16. * Tests the QRString output module
  17. */
  18. class QRStringTest extends QROutputTestAbstract{
  19. /**
  20. * @inheritDoc
  21. * @internal
  22. */
  23. protected function getOutputInterface(QROptions $options):QROutputInterface{
  24. return new QRString($options, $this->matrix);
  25. }
  26. /**
  27. * @inheritDoc
  28. * @internal
  29. */
  30. public function types():array{
  31. return [
  32. 'json' => [QRCode::OUTPUT_STRING_JSON],
  33. 'text' => [QRCode::OUTPUT_STRING_TEXT],
  34. ];
  35. }
  36. /**
  37. * @inheritDoc
  38. */
  39. public function testSetModuleValues():void{
  40. $this->options->moduleValues = [
  41. // data
  42. 1024 => 'A',
  43. 4 => 'B',
  44. ];
  45. $this->outputInterface = $this->getOutputInterface($this->options);
  46. $data = $this->outputInterface->dump();
  47. $this::assertStringContainsString('A', $data);
  48. $this::assertStringContainsString('B', $data);
  49. }
  50. }