AlphaNumTest.php 969 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Class AlphaNumTest
  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\AlphaNum;
  12. use chillerlan\QRCode\Data\QRDataModeInterface;
  13. /**
  14. * Tests the AlphaNum class
  15. */
  16. final class AlphaNumTest extends DataInterfaceTestAbstract{
  17. protected const testData = '0 $%*+-./:';
  18. protected static function getDataModeInterface(string $data):QRDataModeInterface{
  19. return new AlphaNum($data);
  20. }
  21. /**
  22. * isAlphaNum() should pass on the 45 defined characters and fail on anything else (e.g. lowercase)
  23. */
  24. public static function stringValidateProvider():array{
  25. return [
  26. ['ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:', true],
  27. ['abc', false],
  28. ['ÄÖÜ', false],
  29. [',', false],
  30. ['-', true],
  31. ['+', true],
  32. ['.', true],
  33. ['*', true],
  34. [':', true],
  35. ['/', true],
  36. ['\\', false],
  37. ];
  38. }
  39. }