Sha256Test.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
  4. *
  5. * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
  6. */
  7. namespace Lcobucci\JWT\Signer\Ecdsa;
  8. /**
  9. * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
  10. * @since 2.1.0
  11. */
  12. class Sha256Test extends \PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @test
  16. *
  17. * @uses Lcobucci\JWT\Signer\Ecdsa
  18. * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
  19. *
  20. * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getAlgorithmId
  21. */
  22. public function getAlgorithmIdMustBeCorrect()
  23. {
  24. $signer = new Sha256();
  25. $this->assertEquals('ES256', $signer->getAlgorithmId());
  26. }
  27. /**
  28. * @test
  29. *
  30. * @uses Lcobucci\JWT\Signer\Ecdsa
  31. * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
  32. *
  33. * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getAlgorithm
  34. */
  35. public function getAlgorithmMustBeCorrect()
  36. {
  37. $signer = new Sha256();
  38. $this->assertEquals('sha256', $signer->getAlgorithm());
  39. }
  40. /**
  41. * @test
  42. *
  43. * @uses Lcobucci\JWT\Signer\Ecdsa
  44. * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
  45. *
  46. * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getSignatureLength
  47. */
  48. public function getSignatureLengthMustBeCorrect()
  49. {
  50. $signer = new Sha256();
  51. $this->assertEquals(64, $signer->getSignatureLength());
  52. }
  53. }