ByteTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Class ByteTest
  4. *
  5. * @created 24.11.2017
  6. * @author Smiley <smiley@chillerlan.net>
  7. * @copyright 2017 Smiley
  8. * @license MIT
  9. */
  10. namespace chillerlan\QRCodeTest\Data;
  11. use chillerlan\QRCode\Data\Byte;
  12. use chillerlan\QRCode\Data\QRDataModeInterface;
  13. /**
  14. * Tests the Byte class
  15. */
  16. final class ByteTest extends DataInterfaceTestAbstract{
  17. protected const testData = '[¯\_(ツ)_/¯]';
  18. protected static function getDataModeInterface(string $data):QRDataModeInterface{
  19. return new Byte($data);
  20. }
  21. /**
  22. * isByte() passses any binary string and only fails on empty strings
  23. *
  24. * @phpstan-return array<int, array{0: string, 1: bool}>
  25. */
  26. public static function stringValidateProvider():array{
  27. return [
  28. ["\x01\x02\x03", true],
  29. [' ', true], // not empty!
  30. ['0', true], // should survive !empty()
  31. ['', false],
  32. ];
  33. }
  34. /**
  35. * @inheritDoc
  36. */
  37. public function testInvalidDataException():void{
  38. $this::markTestSkipped('N/A (binary mode)');
  39. }
  40. /**
  41. * @inheritDoc
  42. */
  43. public function testBinaryStringInvalid():void{
  44. $this::markTestSkipped('N/A (binary mode)');
  45. }
  46. }