AlphaNumTest.php 878 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. * @phpstan-return array<int, array{0: string, 1: bool}>
  25. */
  26. public static function stringValidateProvider():array{
  27. return [
  28. ['ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:', true],
  29. ['abc', false],
  30. ];
  31. }
  32. }