AlphaNumTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Class AlphaNumTest
  4. *
  5. * @filesource AlphaNumTest.php
  6. * @created 24.11.2017
  7. * @package chillerlan\QRCodeTest\Data
  8. * @author Smiley <smiley@chillerlan.net>
  9. * @copyright 2017 Smiley
  10. * @license MIT
  11. */
  12. namespace chillerlan\QRCodeTest\Data;
  13. use chillerlan\QRCode\Data\{AlphaNum, QRCodeDataException};
  14. /**
  15. * Tests the AlphaNum class
  16. */
  17. final class AlphaNumTest extends DatainterfaceTestAbstract{
  18. /** @internal */
  19. protected array $testdata = [AlphaNum::class, '0 $%*+-./:'];
  20. /** @internal */
  21. protected array $expected = [
  22. 32, 80, 36, 212, 252, 15, 175, 251,
  23. 176, 236, 17, 236, 17, 236, 17, 236,
  24. 17, 236, 17, 236, 17, 236, 17, 236,
  25. 17, 236, 17, 236, 17, 236, 17, 236,
  26. 17, 236, 17, 236, 17, 236, 17, 236,
  27. 17, 236, 17, 236, 17, 236, 17, 236,
  28. 17, 236, 17, 236, 17, 236, 17, 236,
  29. 17, 236, 17, 236, 17, 236, 17, 236,
  30. 17, 236, 17, 236, 17, 236, 17, 236,
  31. 17, 236, 17, 236, 17, 236, 17, 236,
  32. 112, 43, 9, 248, 200, 194, 75, 25,
  33. 205, 173, 154, 68, 191, 16, 128,
  34. 92, 112, 20, 198, 27
  35. ];
  36. /**
  37. * Tests if an exception is thrown when an invalid character is encountered
  38. */
  39. public function testGetCharCodeException():void{
  40. $this->expectException(QRCodeDataException::class);
  41. $this->expectExceptionMessage('illegal char: "#" [35]');
  42. $this->testdata = [AlphaNum::class, '#'];
  43. $this->setTestData();
  44. }
  45. }