QRStringTEXTTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Class QRStringTEXTTest
  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\Data\QRMatrix;
  12. use chillerlan\QRCode\Output\QROutputInterface;
  13. use chillerlan\QRCode\Output\QRStringText;
  14. /**
  15. *
  16. */
  17. final class QRStringTEXTTest extends QROutputTestAbstract{
  18. protected string $type = QROutputInterface::STRING_TEXT;
  19. protected string $FQN = QRStringText::class;
  20. public static function moduleValueProvider():array{
  21. return [
  22. 'invalid: wrong type' => [[], false],
  23. 'valid: string' => ['abc', true],
  24. 'valid: zero length string' => ['', true],
  25. 'valid: empty string' => [' ', true],
  26. ];
  27. }
  28. /**
  29. * @inheritDoc
  30. */
  31. public function testSetModuleValues():void{
  32. $this->options->moduleValues = [
  33. // data
  34. QRMatrix::M_DATA_DARK => 'A',
  35. QRMatrix::M_DATA => 'B',
  36. ];
  37. $this->outputInterface = new $this->FQN($this->options, $this->matrix);
  38. $data = $this->outputInterface->dump();
  39. $this::assertStringContainsString('A', $data);
  40. $this::assertStringContainsString('B', $data);
  41. }
  42. }