AlphaNumTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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, QRCodeDataException};
  12. /**
  13. * Tests the AlphaNum class
  14. */
  15. final class AlphaNumTest extends DatainterfaceTestAbstract{
  16. /** @internal */
  17. protected array $testdata = [AlphaNum::class, '0 $%*+-./:'];
  18. /** @internal */
  19. protected array $expected = [
  20. 32, 80, 36, 212, 252, 15, 175, 251,
  21. 176, 236, 17, 236, 17, 236, 17, 236,
  22. 17, 236, 17, 236, 17, 236, 17, 236,
  23. 17, 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. 112, 43, 9, 248, 200, 194, 75, 25,
  31. 205, 173, 154, 68, 191, 16, 128,
  32. 92, 112, 20, 198, 27
  33. ];
  34. /**
  35. * Tests if an exception is thrown when an invalid character is encountered
  36. */
  37. public function testGetCharCodeException():void{
  38. $this->expectException(QRCodeDataException::class);
  39. $this->expectExceptionMessage('illegal char: "#" [35]');
  40. $this->testdata = [AlphaNum::class, '#'];
  41. $this->setTestData();
  42. }
  43. }