QRStringTest.php 1.3 KB

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