ByteTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. declare(strict_types=1);
  11. namespace chillerlan\QRCodeTest\Data;
  12. use chillerlan\QRCode\Data\{Byte, QRDataModeInterface};
  13. use PHPUnit\Framework\Attributes\Test;
  14. /**
  15. * Tests the Byte class
  16. */
  17. final class ByteTest extends DataInterfaceTestAbstract{
  18. protected const testData = '[¯\_(ツ)_/¯]';
  19. protected static function getDataModeInterface(string $data):QRDataModeInterface{
  20. return new Byte($data);
  21. }
  22. /**
  23. * isByte() passses any binary string and only fails on empty strings
  24. *
  25. * @phpstan-return array<int, array{0: string, 1: bool}>
  26. */
  27. public static function stringValidateProvider():array{
  28. return [
  29. ["\x01\x02\x03", true],
  30. [' ', true], // not empty!
  31. ['0', true], // should survive !empty()
  32. ['', false],
  33. ];
  34. }
  35. #[Test]
  36. public function binaryStringInvalid():void{
  37. $this::markTestSkipped('N/A (binary mode)');
  38. }
  39. #[Test]
  40. public function invalidDataException():void{
  41. $this::markTestSkipped('N/A (binary mode)');
  42. }
  43. }