QREpsTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * QREpsTest.php
  4. *
  5. * @created 16.03.2023
  6. * @author smiley <smiley@chillerlan.net>
  7. * @copyright 2023 smiley
  8. * @license MIT
  9. */
  10. declare(strict_types=1);
  11. namespace chillerlan\QRCodeTest\Output;
  12. use chillerlan\QRCode\QROptions;
  13. use chillerlan\QRCode\Data\QRMatrix;
  14. use chillerlan\QRCode\Output\{QREps, QROutputInterface};
  15. use chillerlan\Settings\SettingsContainerInterface;
  16. class QREpsTest extends QROutputTestAbstract{
  17. public static function moduleValueProvider():array{
  18. return [
  19. 'valid: 3 int' => [[123, 123, 123], true],
  20. 'valid: 4 int' => [[123, 123, 123, 123], true],
  21. 'valid: w/invalid extra element' => [[123, 123, 123, 123, 'abc'], true],
  22. 'valid: numeric string' => [['123', '123', '123'], true],
  23. 'invalid: wrong type' => ['foo', false],
  24. 'invalid: array too short' => [[1, 2], false],
  25. 'invalid: contains non-number' => [[1, 'b', 3], false],
  26. ];
  27. }
  28. protected function getOutputInterface(
  29. SettingsContainerInterface|QROptions $options,
  30. QRMatrix $matrix,
  31. ):QROutputInterface{
  32. return new QREps($options, $matrix);
  33. }
  34. public function testSetModuleValues():void{
  35. $this->options->moduleValues = [
  36. // data
  37. QRMatrix::M_DATA_DARK => [0, 0, 0],
  38. QRMatrix::M_DATA => [255, 255, 255],
  39. ];
  40. $this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
  41. $this->outputInterface->dump();
  42. /** @phpstan-ignore-next-line */
  43. $this::assertTrue(true); // tricking the code coverage
  44. }
  45. }