QRStringTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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, Output\QRString};
  14. class QRStringTest extends QROutputTestAbstract{
  15. protected string $FQCN = QRString::class;
  16. public function types():array{
  17. return [
  18. 'json' => [QRCode::OUTPUT_STRING_JSON],
  19. 'text' => [QRCode::OUTPUT_STRING_TEXT],
  20. ];
  21. }
  22. /**
  23. * @dataProvider types
  24. */
  25. public function testStringOutput(string $type):void{
  26. $this->options->outputType = $type;
  27. $this->options->cachefile = $this::cachefile.$type;
  28. $this->setOutputInterface();
  29. $data = $this->outputInterface->dump();
  30. $this::assertSame($data, file_get_contents($this->options->cachefile));
  31. }
  32. public function testSetModuleValues():void{
  33. $this->options->moduleValues = [
  34. // data
  35. 1024 => 'A',
  36. 4 => 'B',
  37. ];
  38. $this->setOutputInterface();
  39. $data = $this->outputInterface->dump();
  40. $this::assertStringContainsString('A', $data);
  41. $this::assertStringContainsString('B', $data);
  42. }
  43. }