Procházet zdrojové kódy

Wesmiler 人人车 初始化项目 0816

APPLE před 3 roky
rodič
revize
21d1134c06
28 změnil soubory, kde provedl 3727 přidání a 0 odebrání
  1. 633 0
      vendor/qeq66/jwt/test/unit/BuilderTest.php
  2. 84 0
      vendor/qeq66/jwt/test/unit/Claim/BasicTest.php
  3. 83 0
      vendor/qeq66/jwt/test/unit/Claim/EqualsToTest.php
  4. 168 0
      vendor/qeq66/jwt/test/unit/Claim/FactoryTest.php
  5. 107 0
      vendor/qeq66/jwt/test/unit/Claim/GreaterOrEqualsToTest.php
  6. 107 0
      vendor/qeq66/jwt/test/unit/Claim/LesserOrEqualsToTest.php
  7. 244 0
      vendor/qeq66/jwt/test/unit/ParserTest.php
  8. 56 0
      vendor/qeq66/jwt/test/unit/Parsing/DecoderTest.php
  9. 53 0
      vendor/qeq66/jwt/test/unit/Parsing/EncoderTest.php
  10. 73 0
      vendor/qeq66/jwt/test/unit/SignatureTest.php
  11. 128 0
      vendor/qeq66/jwt/test/unit/Signer/BaseSignerTest.php
  12. 127 0
      vendor/qeq66/jwt/test/unit/Signer/Ecdsa/MultibyteStringConverterTest.php
  13. 60 0
      vendor/qeq66/jwt/test/unit/Signer/Ecdsa/Sha256Test.php
  14. 60 0
      vendor/qeq66/jwt/test/unit/Signer/Ecdsa/Sha384Test.php
  15. 60 0
      vendor/qeq66/jwt/test/unit/Signer/Ecdsa/Sha512Test.php
  16. 117 0
      vendor/qeq66/jwt/test/unit/Signer/EcdsaTest.php
  17. 39 0
      vendor/qeq66/jwt/test/unit/Signer/Hmac/Sha256Test.php
  18. 39 0
      vendor/qeq66/jwt/test/unit/Signer/Hmac/Sha384Test.php
  19. 39 0
      vendor/qeq66/jwt/test/unit/Signer/Hmac/Sha512Test.php
  20. 134 0
      vendor/qeq66/jwt/test/unit/Signer/HmacTest.php
  21. 119 0
      vendor/qeq66/jwt/test/unit/Signer/KeyTest.php
  22. 49 0
      vendor/qeq66/jwt/test/unit/Signer/KeychainTest.php
  23. 39 0
      vendor/qeq66/jwt/test/unit/Signer/Rsa/Sha256Test.php
  24. 39 0
      vendor/qeq66/jwt/test/unit/Signer/Rsa/Sha384Test.php
  25. 39 0
      vendor/qeq66/jwt/test/unit/Signer/Rsa/Sha512Test.php
  26. 188 0
      vendor/qeq66/jwt/test/unit/Signer/RsaTest.php
  27. 573 0
      vendor/qeq66/jwt/test/unit/TokenTest.php
  28. 270 0
      vendor/qeq66/jwt/test/unit/ValidationDataTest.php

+ 633 - 0
vendor/qeq66/jwt/test/unit/BuilderTest.php

@@ -0,0 +1,633 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use Lcobucci\JWT\Claim\Factory as ClaimFactory;
+use Lcobucci\JWT\Parsing\Encoder;
+use Lcobucci\JWT\Signer\Key;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class BuilderTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @var Encoder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $encoder;
+
+    /**
+     * @var ClaimFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $claimFactory;
+
+    /**
+     * @var Claim|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $defaultClaim;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->encoder = $this->createMock(Encoder::class);
+        $this->claimFactory = $this->createMock(ClaimFactory::class);
+        $this->defaultClaim = $this->createMock(Claim::class);
+
+        $this->claimFactory->expects($this->any())
+                           ->method('create')
+                           ->willReturn($this->defaultClaim);
+    }
+
+    /**
+     * @return Builder
+     */
+    private function createBuilder()
+    {
+        return new Builder($this->encoder, $this->claimFactory);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder::__construct
+     */
+    public function constructMustInitializeTheAttributes()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals([], 'claims', $builder);
+        $this->assertAttributeSame($this->encoder, 'encoder', $builder);
+        $this->assertAttributeSame($this->claimFactory, 'claimFactory', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::permittedFor
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function permittedForMustChangeTheAudClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->permittedFor('test');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::permittedFor
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function permittedForCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->permittedFor('test', true);
+
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'aud' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::permittedFor
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function permittedForMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->permittedFor('test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::expiresAt
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function expiresAtMustChangeTheExpClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->expiresAt('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['exp' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::expiresAt
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function expiresAtCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->expiresAt('2', true);
+
+        $this->assertAttributeEquals(['exp' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'exp' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::expiresAt
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function expiresAtMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->expiresAt('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::identifiedBy
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function identifiedByMustChangeTheJtiClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->identifiedBy('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['jti' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::identifiedBy
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function identifiedByCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->identifiedBy('2', true);
+
+        $this->assertAttributeEquals(['jti' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'jti' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::identifiedBy
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function identifiedByMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->identifiedBy('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::issuedAt
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function issuedAtMustChangeTheIatClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->issuedAt('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['iat' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::issuedAt
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function issuedAtCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->issuedAt('2', true);
+
+        $this->assertAttributeEquals(['iat' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'iat' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::issuedAt
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function issuedAtMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->issuedAt('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::issuedBy
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function issuedByMustChangeTheIssClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->issuedBy('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['iss' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::issuedBy
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function issuedByCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->issuedBy('2', true);
+
+        $this->assertAttributeEquals(['iss' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'iss' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::issuedBy
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function issuedByMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->issuedBy('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::canOnlyBeUsedAfter
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function canOnlyBeUsedAfterMustChangeTheNbfClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->canOnlyBeUsedAfter('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['nbf' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::canOnlyBeUsedAfter
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function canOnlyBeUsedAfterCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->canOnlyBeUsedAfter('2', true);
+
+        $this->assertAttributeEquals(['nbf' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'nbf' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::canOnlyBeUsedAfter
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function canOnlyBeUsedAfterMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->canOnlyBeUsedAfter('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::relatedTo
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function relatedToMustChangeTheSubClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->relatedTo('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['sub' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::relatedTo
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function relatedToCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->relatedTo('2', true);
+
+        $this->assertAttributeEquals(['sub' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'sub' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     *
+     * @covers Lcobucci\JWT\Builder::relatedTo
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function relatedToMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->relatedTo('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     *
+     * @covers Lcobucci\JWT\Builder::withClaim
+     */
+    public function withClaimMustConfigureTheGivenClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->withClaim('userId', 2);
+
+        $this->assertAttributeEquals(['userId' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     *
+     * @covers Lcobucci\JWT\Builder::withClaim
+     */
+    public function withClaimMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->withClaim('userId', 2));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     *
+     * @covers Lcobucci\JWT\Builder::withHeader
+     */
+    public function withHeaderMustConfigureTheGivenClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->withHeader('userId', 2);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'userId' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     *
+     * @covers Lcobucci\JWT\Builder::withHeader
+     */
+    public function withHeaderMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->withHeader('userId', 2));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::getToken
+     * @uses Lcobucci\JWT\Token
+     *
+     * @covers Lcobucci\JWT\Builder::sign
+     */
+    public function signMustConfigureSignerAndKey()
+    {
+        $signer = $this->createMock(Signer::class);
+
+        $builder = $this->createBuilder();
+        $builder->sign($signer, 'test');
+
+        $this->assertAttributeSame($signer, 'signer', $builder);
+        $this->assertAttributeEquals(new Key('test'), 'key', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::getToken
+     * @uses Lcobucci\JWT\Token
+     *
+     * @covers Lcobucci\JWT\Builder::sign
+     */
+    public function signMustKeepAFluentInterface()
+    {
+        $signer = $this->createMock(Signer::class);
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->sign($signer, 'test'));
+
+        return $builder;
+    }
+
+    /**
+     * @test
+     *
+     * @depends signMustKeepAFluentInterface
+     *
+     * @covers Lcobucci\JWT\Builder::unsign
+     */
+    public function unsignMustRemoveTheSignerAndKey(Builder $builder)
+    {
+        $builder->unsign();
+
+        $this->assertAttributeSame(null, 'signer', $builder);
+        $this->assertAttributeSame(null, 'key', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @depends signMustKeepAFluentInterface
+     *
+     * @covers Lcobucci\JWT\Builder::unsign
+     */
+    public function unsignMustKeepAFluentInterface(Builder $builder)
+    {
+        $this->assertSame($builder, $builder->unsign());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::withClaim
+     * @uses Lcobucci\JWT\Token
+     *
+     * @covers Lcobucci\JWT\Builder::getToken
+     */
+    public function getTokenMustReturnANewTokenWithCurrentConfiguration()
+    {
+        $signer = $this->createMock(Signer::class);
+        $signature = $this->createMock(Signature::class);
+
+        $signer->method('sign')->willReturn($signature);
+
+        $this->encoder->expects($this->exactly(2))
+                      ->method('jsonEncode')
+                      ->withConsecutive([['typ'=> 'JWT', 'alg' => 'none']], [['test' => $this->defaultClaim]])
+                      ->willReturnOnConsecutiveCalls('1', '2');
+
+        $this->encoder->expects($this->exactly(3))
+                      ->method('base64UrlEncode')
+                      ->withConsecutive(['1'], ['2'], [$signature])
+                      ->willReturnOnConsecutiveCalls('1', '2', '3');
+
+        $builder = $this->createBuilder()->withClaim('test', 123);
+        $token = $builder->getToken($signer, new Key('testing'));
+
+        $this->assertAttributeEquals(['1', '2', '3'], 'payload', $token);
+        $this->assertAttributeEquals($token->getHeaders(), 'headers', $builder);
+        $this->assertAttributeEquals($token->getClaims(), 'claims', $builder);
+        $this->assertAttributeSame($signature, 'signature', $token);
+    }
+}

+ 84 - 0
vendor/qeq66/jwt/test/unit/Claim/BasicTest.php

@@ -0,0 +1,84 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class BasicTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::__construct
+     */
+    public function constructorShouldConfigureTheAttributes()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertAttributeEquals('test', 'name', $claim);
+        $this->assertAttributeEquals(1, 'value', $claim);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::getName
+     */
+    public function getNameShouldReturnTheClaimName()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertEquals('test', $claim->getName());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::getValue
+     */
+    public function getValueShouldReturnTheClaimValue()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertEquals(1, $claim->getValue());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::jsonSerialize
+     */
+    public function jsonSerializeShouldReturnTheClaimValue()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertEquals(1, $claim->jsonSerialize());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::__toString
+     */
+    public function toStringShouldReturnTheClaimValue()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertEquals('1', (string) $claim);
+    }
+}

+ 83 - 0
vendor/qeq66/jwt/test/unit/Claim/EqualsToTest.php

@@ -0,0 +1,83 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class EqualsToTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\EqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValidationDontHaveTheClaim()
+    {
+        $claim = new EqualsTo('iss', 'test');
+
+        $this->assertTrue($claim->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\EqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsEqualsToValidationData()
+    {
+        $claim = new EqualsTo('iss', 'test');
+
+        $data = new ValidationData();
+        $data->setIssuer('test');
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\EqualsTo::validate
+     */
+    public function validateShouldReturnFalseWhenValueIsNotEqualsToValidationData()
+    {
+        $claim = new EqualsTo('iss', 'test');
+
+        $data = new ValidationData();
+        $data->setIssuer('test1');
+
+        $this->assertFalse($claim->validate($data));
+    }
+}

+ 168 - 0
vendor/qeq66/jwt/test/unit/Claim/FactoryTest.php

@@ -0,0 +1,168 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class FactoryTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::__construct
+     */
+    public function constructMustConfigureTheCallbacks()
+    {
+        $callback = function () {
+        };
+        $factory = new Factory(['test' => $callback]);
+
+        $expected = [
+            'iat' => [$factory, 'createLesserOrEqualsTo'],
+            'nbf' => [$factory, 'createLesserOrEqualsTo'],
+            'exp' => [$factory, 'createGreaterOrEqualsTo'],
+            'iss' => [$factory, 'createEqualsTo'],
+            'aud' => [$factory, 'createEqualsTo'],
+            'sub' => [$factory, 'createEqualsTo'],
+            'jti' => [$factory, 'createEqualsTo'],
+            'test' => $callback
+        ];
+
+        $this->assertAttributeEquals($expected, 'callbacks', $factory);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createLesserOrEqualsTo
+     */
+    public function createShouldReturnALesserOrEqualsToClaimForIssuedAt()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(LesserOrEqualsTo::class, $claim->create('iat', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createLesserOrEqualsTo
+     */
+    public function createShouldReturnALesserOrEqualsToClaimForNotBefore()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(LesserOrEqualsTo::class, $claim->create('nbf', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createGreaterOrEqualsTo
+     */
+    public function createShouldReturnAGreaterOrEqualsToClaimForExpiration()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(GreaterOrEqualsTo::class, $claim->create('exp', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo
+     */
+    public function createShouldReturnAnEqualsToClaimForId()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(EqualsTo::class, $claim->create('jti', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo
+     */
+    public function createShouldReturnAnEqualsToClaimForIssuer()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(EqualsTo::class, $claim->create('iss', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo
+     */
+    public function createShouldReturnAnEqualsToClaimForAudience()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(EqualsTo::class, $claim->create('aud', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo
+     */
+    public function createShouldReturnAnEqualsToClaimForSubject()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(EqualsTo::class, $claim->create('sub', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createBasic
+     */
+    public function createShouldReturnABasiclaimForOtherClaims()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(Basic::class, $claim->create('test', 1));
+    }
+}

+ 107 - 0
vendor/qeq66/jwt/test/unit/Claim/GreaterOrEqualsToTest.php

@@ -0,0 +1,107 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class GreaterOrEqualsToTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValidationDontHaveTheClaim()
+    {
+        $claim = new GreaterOrEqualsTo('iss', 10);
+
+        $this->assertTrue($claim->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsGreaterThanValidationData()
+    {
+        $claim = new GreaterOrEqualsTo('iss', 11);
+
+        $data = new ValidationData();
+        $data->setIssuer(10);
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsEqualsToValidationData()
+    {
+        $claim = new GreaterOrEqualsTo('iss', 10);
+
+        $data = new ValidationData();
+        $data->setIssuer(10);
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate
+     */
+    public function validateShouldReturnFalseWhenValueIsLesserThanValidationData()
+    {
+        $claim = new GreaterOrEqualsTo('iss', 10);
+
+        $data = new ValidationData();
+        $data->setIssuer(11);
+
+        $this->assertFalse($claim->validate($data));
+    }
+}

+ 107 - 0
vendor/qeq66/jwt/test/unit/Claim/LesserOrEqualsToTest.php

@@ -0,0 +1,107 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class LesserOrEqualsToTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValidationDontHaveTheClaim()
+    {
+        $claim = new LesserOrEqualsTo('iss', 10);
+
+        $this->assertTrue($claim->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsLesserThanValidationData()
+    {
+        $claim = new LesserOrEqualsTo('iss', 10);
+
+        $data = new ValidationData();
+        $data->setIssuer(11);
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsEqualsToValidationData()
+    {
+        $claim = new LesserOrEqualsTo('iss', 10);
+
+        $data = new ValidationData();
+        $data->setIssuer(10);
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate
+     */
+    public function validateShouldReturnFalseWhenValueIsGreaterThanValidationData()
+    {
+        $claim = new LesserOrEqualsTo('iss', 11);
+
+        $data = new ValidationData();
+        $data->setIssuer(10);
+
+        $this->assertFalse($claim->validate($data));
+    }
+}

+ 244 - 0
vendor/qeq66/jwt/test/unit/ParserTest.php

@@ -0,0 +1,244 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use Lcobucci\JWT\Claim\Factory as ClaimFactory;
+use Lcobucci\JWT\Parsing\Decoder;
+use RuntimeException;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class ParserTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @var Decoder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $decoder;
+
+    /**
+     * @var ClaimFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $claimFactory;
+
+    /**
+     * @var Claim|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $defaultClaim;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->decoder = $this->createMock(Decoder::class);
+        $this->claimFactory = $this->createMock(ClaimFactory::class, [], [], '', false);
+        $this->defaultClaim = $this->createMock(Claim::class);
+
+        $this->claimFactory->expects($this->any())
+                           ->method('create')
+                           ->willReturn($this->defaultClaim);
+    }
+
+    /**
+     * @return Parser
+     */
+    private function createParser()
+    {
+        return new Parser($this->decoder, $this->claimFactory);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parser::__construct
+     */
+    public function constructMustConfigureTheAttributes()
+    {
+        $parser = $this->createParser();
+
+        $this->assertAttributeSame($this->decoder, 'decoder', $parser);
+        $this->assertAttributeSame($this->claimFactory, 'claimFactory', $parser);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     *
+     * @expectedException InvalidArgumentException
+     */
+    public function parseMustRaiseExceptionWhenJWSIsNotAString()
+    {
+        $parser = $this->createParser();
+        $parser->parse(['asdasd']);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     *
+     * @expectedException InvalidArgumentException
+     */
+    public function parseMustRaiseExceptionWhenJWSDontHaveThreeParts()
+    {
+        $parser = $this->createParser();
+        $parser->parse('');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     *
+     * @expectedException RuntimeException
+     */
+    public function parseMustRaiseExceptionWhenHeaderCannotBeDecoded()
+    {
+        $this->decoder->expects($this->any())
+                      ->method('jsonDecode')
+                      ->willThrowException(new RuntimeException());
+
+        $parser = $this->createParser();
+        $parser->parse('asdfad.asdfasdf.');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     *
+     * @expectedException InvalidArgumentException
+     */
+    public function parseMustRaiseExceptionWhenHeaderIsFromAnEncryptedToken()
+    {
+        $this->decoder->expects($this->any())
+                      ->method('jsonDecode')
+                      ->willReturn(['enc' => 'AAA']);
+
+        $parser = $this->createParser();
+        $parser->parse('a.a.');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     * @covers Lcobucci\JWT\Parser::parseClaims
+     * @covers Lcobucci\JWT\Parser::parseSignature
+     *
+     */
+    public function parseMustReturnANonSignedTokenWhenSignatureIsNotInformed()
+    {
+        $this->decoder->expects($this->at(1))
+                      ->method('jsonDecode')
+                      ->willReturn(['typ' => 'JWT', 'alg' => 'none']);
+
+        $this->decoder->expects($this->at(3))
+                      ->method('jsonDecode')
+                      ->willReturn(['aud' => 'test']);
+
+        $parser = $this->createParser();
+        $token = $parser->parse('a.a.');
+
+        $this->assertAttributeEquals(['typ' => 'JWT', 'alg' => 'none'], 'headers', $token);
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token);
+        $this->assertAttributeEquals(null, 'signature', $token);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     * @covers Lcobucci\JWT\Parser::parseClaims
+     * @covers Lcobucci\JWT\Parser::parseSignature
+     */
+    public function parseShouldReplicateClaimValueOnHeaderWhenNeeded()
+    {
+        $this->decoder->expects($this->at(1))
+                      ->method('jsonDecode')
+                      ->willReturn(['typ' => 'JWT', 'alg' => 'none', 'aud' => 'test']);
+
+        $this->decoder->expects($this->at(3))
+                      ->method('jsonDecode')
+                      ->willReturn(['aud' => 'test']);
+
+        $parser = $this->createParser();
+        $token = $parser->parse('a.a.');
+
+        $this->assertAttributeEquals(
+            ['typ' => 'JWT', 'alg' => 'none', 'aud' => $this->defaultClaim],
+            'headers',
+            $token
+        );
+
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token);
+        $this->assertAttributeEquals(null, 'signature', $token);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Signature::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     * @covers Lcobucci\JWT\Parser::parseClaims
+     * @covers Lcobucci\JWT\Parser::parseSignature
+     */
+    public function parseMustReturnASignedTokenWhenSignatureIsInformed()
+    {
+        $this->decoder->expects($this->at(1))
+                      ->method('jsonDecode')
+                      ->willReturn(['typ' => 'JWT', 'alg' => 'HS256']);
+
+        $this->decoder->expects($this->at(3))
+                      ->method('jsonDecode')
+                      ->willReturn(['aud' => 'test']);
+
+        $this->decoder->expects($this->at(4))
+                      ->method('base64UrlDecode')
+                      ->willReturn('aaa');
+
+        $parser = $this->createParser();
+        $token = $parser->parse('a.a.a');
+
+        $this->assertAttributeEquals(['typ' => 'JWT', 'alg' => 'HS256'], 'headers', $token);
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token);
+        $this->assertAttributeEquals(new Signature('aaa'), 'signature', $token);
+    }
+}

+ 56 - 0
vendor/qeq66/jwt/test/unit/Parsing/DecoderTest.php

@@ -0,0 +1,56 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Parsing;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class DecoderTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Decoder::jsonDecode
+     */
+    public function jsonDecodeMustReturnTheDecodedData()
+    {
+        $decoder = new Decoder();
+
+        $this->assertEquals(
+            (object) ['test' => 'test'],
+            $decoder->jsonDecode('{"test":"test"}')
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Decoder::jsonDecode
+     *
+     * @expectedException \RuntimeException
+     */
+    public function jsonDecodeMustRaiseExceptionWhenAnErrorHasOccured()
+    {
+        $decoder = new Decoder();
+        $decoder->jsonDecode('{"test":\'test\'}');
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Decoder::base64UrlDecode
+     */
+    public function base64UrlDecodeMustReturnTheRightData()
+    {
+        $data = base64_decode('0MB2wKB+L3yvIdzeggmJ+5WOSLaRLTUPXbpzqUe0yuo=');
+
+        $decoder = new Decoder();
+        $this->assertEquals($data, $decoder->base64UrlDecode('0MB2wKB-L3yvIdzeggmJ-5WOSLaRLTUPXbpzqUe0yuo'));
+    }
+}

+ 53 - 0
vendor/qeq66/jwt/test/unit/Parsing/EncoderTest.php

@@ -0,0 +1,53 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Parsing;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class EncoderTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Encoder::jsonEncode
+     */
+    public function jsonEncodeMustReturnAJSONString()
+    {
+        $encoder = new Encoder();
+
+        $this->assertEquals('{"test":"test"}', $encoder->jsonEncode(['test' => 'test']));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Encoder::jsonEncode
+     *
+     * @expectedException \RuntimeException
+     */
+    public function jsonEncodeMustRaiseExceptionWhenAnErrorHasOccured()
+    {
+        $encoder = new Encoder();
+        $encoder->jsonEncode("\xB1\x31");
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Encoder::base64UrlEncode
+     */
+    public function base64UrlEncodeMustReturnAnUrlSafeBase64()
+    {
+        $data = base64_decode('0MB2wKB+L3yvIdzeggmJ+5WOSLaRLTUPXbpzqUe0yuo=');
+
+        $encoder = new Encoder();
+        $this->assertEquals('0MB2wKB-L3yvIdzeggmJ-5WOSLaRLTUPXbpzqUe0yuo', $encoder->base64UrlEncode($data));
+    }
+}

+ 73 - 0
vendor/qeq66/jwt/test/unit/SignatureTest.php

@@ -0,0 +1,73 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class SignatureTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @var Signer|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $signer;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->signer = $this->createMock(Signer::class);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signature::__construct
+     */
+    public function constructorMustConfigureAttributes()
+    {
+        $signature = new Signature('test');
+
+        $this->assertAttributeEquals('test', 'hash', $signature);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     *
+     * @covers Lcobucci\JWT\Signature::__toString
+     */
+    public function toStringMustReturnTheHash()
+    {
+        $signature = new Signature('test');
+
+        $this->assertEquals('test', (string) $signature);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signature::__toString
+     *
+     * @covers Lcobucci\JWT\Signature::verify
+     */
+    public function verifyMustReturnWhatSignerSays()
+    {
+        $this->signer->expects($this->any())
+                     ->method('verify')
+                     ->willReturn(true);
+
+        $signature = new Signature('test');
+
+        $this->assertTrue($signature->verify($this->signer, 'one', 'key'));
+    }
+}

+ 128 - 0
vendor/qeq66/jwt/test/unit/Signer/BaseSignerTest.php

@@ -0,0 +1,128 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use Lcobucci\JWT\Signature;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class BaseSignerTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @var BaseSigner|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $signer;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->signer = $this->getMockForAbstractClass(BaseSigner::class);
+
+        $this->signer->method('getAlgorithmId')
+                     ->willReturn('TEST123');
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::modifyHeader
+     */
+    public function modifyHeaderShouldChangeAlgorithm()
+    {
+        $headers = ['typ' => 'JWT'];
+
+        $this->signer->modifyHeader($headers);
+
+        $this->assertEquals($headers['typ'], 'JWT');
+        $this->assertEquals($headers['alg'], 'TEST123');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::sign
+     * @covers Lcobucci\JWT\Signer\BaseSigner::getKey
+     */
+    public function signMustReturnANewSignature()
+    {
+        $key = new Key('123');
+
+        $this->signer->expects($this->once())
+                     ->method('createHash')
+                     ->with('test', $key)
+                     ->willReturn('test');
+
+        $this->assertEquals(new Signature('test'), $this->signer->sign('test', $key));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::sign
+     * @covers Lcobucci\JWT\Signer\BaseSigner::getKey
+     */
+    public function signShouldConvertKeyWhenItsNotAnObject()
+    {
+        $this->signer->expects($this->once())
+                     ->method('createHash')
+                     ->with('test', new Key('123'))
+                     ->willReturn('test');
+
+        $this->assertEquals(new Signature('test'), $this->signer->sign('test', '123'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::verify
+     * @covers Lcobucci\JWT\Signer\BaseSigner::getKey
+     */
+    public function verifyShouldDelegateTheCallToAbstractMethod()
+    {
+        $key = new Key('123');
+
+        $this->signer->expects($this->once())
+                     ->method('doVerify')
+                     ->with('test', 'test', $key)
+                     ->willReturn(true);
+
+        $this->assertTrue($this->signer->verify('test', 'test', $key));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::verify
+     * @covers Lcobucci\JWT\Signer\BaseSigner::getKey
+     */
+    public function verifyShouldConvertKeyWhenItsNotAnObject()
+    {
+        $this->signer->expects($this->once())
+                     ->method('doVerify')
+                     ->with('test', 'test', new Key('123'))
+                     ->willReturn(true);
+
+        $this->assertTrue($this->signer->verify('test', 'test', '123'));
+    }
+}

+ 127 - 0
vendor/qeq66/jwt/test/unit/Signer/Ecdsa/MultibyteStringConverterTest.php

@@ -0,0 +1,127 @@
+<?php
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+use InvalidArgumentException;
+use PHPUnit\Framework\TestCase;
+use function bin2hex;
+use function hex2bin;
+use function strlen;
+
+/**
+ * @coversDefaultClass \Lcobucci\JWT\Signer\Ecdsa\MultibyteStringConverter
+ */
+final class MultibyteStringConverterTest extends TestCase
+{
+    /**
+     * @test
+     * @dataProvider pointsConversionData
+     *
+     * @covers ::toAsn1
+     * @covers ::octetLength
+     * @covers ::preparePositiveInteger
+     */
+    public function toAsn1ShouldReturnThePointsInAnAsn1SequenceFormat(
+        $r,
+        $s,
+        $asn1
+    ) {
+        $converter = new MultibyteStringConverter();
+        $message   = hex2bin($r . $s);
+
+        self::assertSame($asn1, bin2hex($converter->toAsn1($message, strlen($r))));
+    }
+
+    /**
+     * @test
+     *
+     * @covers ::toAsn1
+     * @covers ::octetLength
+     */
+    public function toAsn1ShouldRaiseExceptionWhenPointsDoNotHaveCorrectLength()
+    {
+        $converter = new MultibyteStringConverter();
+
+        self::expectException(InvalidArgumentException::class);
+        $converter->toAsn1('a very wrong string', 64);
+    }
+
+    /**
+     * @test
+     * @dataProvider pointsConversionData
+     *
+     * @covers ::fromAsn1
+     * @covers ::readAsn1Content
+     * @covers ::readAsn1Integer
+     * @covers ::retrievePositiveInteger
+     */
+    public function fromAsn1ShouldReturnTheConcatenatedPoints($r, $s, $asn1)
+    {
+        $converter = new MultibyteStringConverter();
+        $message   = hex2bin($asn1);
+
+        self::assertSame($r . $s, bin2hex($converter->fromAsn1($message, strlen($r))));
+    }
+
+    /**
+     * @return string[][]
+     */
+    public function pointsConversionData()
+    {
+        return [
+            [
+                'efd48b2aacb6a8fd1140dd9cd45e81d69d2c877b56aaf991c34d0ea84eaf3716',
+                'f7cb1c942d657c41d436c7a1b6e29f65f3e900dbb9aff4064dc4ab2f843acda8',
+                '3046022100efd48b2aacb6a8fd1140dd9cd45e81d69d2c877b56aaf991c34d0ea84eaf3716022100f7cb1c942d657c41d436c7'
+                . 'a1b6e29f65f3e900dbb9aff4064dc4ab2f843acda8',
+            ],
+            [
+                '94edbb92a5ecb8aad4736e56c691916b3f88140666ce9fa73d64c4ea95ad133c81a648152e44acf96e36dd1e80fabe46',
+                '99ef4aeb15f178cea1fe40db2603138f130e740a19624526203b6351d0a3a94fa329c145786e679e7b82c71a38628ac8',
+                '306602310094edbb92a5ecb8aad4736e56c691916b3f88140666ce9fa73d64c4ea95ad133c81a648152e44acf96e36dd1e80fa'
+                . 'be4602310099ef4aeb15f178cea1fe40db2603138f130e740a19624526203b6351d0a3a94fa329c145786e679e7b82c71a38'
+                . '628ac8',
+            ],
+            [
+                '00c328fafcbd79dd77850370c46325d987cb525569fb63c5d3bc53950e6d4c5f174e25a1ee9017b5d450606add152b534931d7'
+                . 'd4e8455cc91f9b15bf05ec36e377fa',
+                '00617cce7cf5064806c467f678d3b4080d6f1cc50af26ca209417308281b68af282623eaa63e5b5c0723d8b8c37ff0777b1a20'
+                . 'f8ccb1dccc43997f1ee0e44da4a67a',
+                '308187024200c328fafcbd79dd77850370c46325d987cb525569fb63c5d3bc53950e6d4c5f174e25a1ee9017b5d450606add15'
+                . '2b534931d7d4e8455cc91f9b15bf05ec36e377fa0241617cce7cf5064806c467f678d3b4080d6f1cc50af26ca20941730828'
+                . '1b68af282623eaa63e5b5c0723d8b8c37ff0777b1a20f8ccb1dccc43997f1ee0e44da4a67a',
+            ],
+        ];
+    }
+
+    /**
+     * @test
+     * @dataProvider invalidAsn1Structures
+     *
+     * @covers ::fromAsn1
+     * @covers ::readAsn1Content
+     * @covers ::readAsn1Integer
+     * @covers ::retrievePositiveInteger
+     */
+    public function fromAsn1ShouldRaiseExceptionOnInvalidMessage($message)
+    {
+        $converter = new MultibyteStringConverter();
+        $message   = hex2bin($message);
+
+        $this->expectException(InvalidArgumentException::class);
+        $converter->fromAsn1($message, 64);
+    }
+
+    /**
+     * @return string[][]
+     */
+    public function invalidAsn1Structures()
+    {
+        return [
+            'Not a sequence'           => [''],
+            'Sequence without length'  => ['30'],
+            'Only one string element'  => ['3006030204f0'],
+            'Only one integer element' => ['3004020101'],
+            'Integer+string elements'  => ['300a020101030204f0'],
+        ];
+    }
+}

+ 60 - 0
vendor/qeq66/jwt/test/unit/Signer/Ecdsa/Sha256Test.php

@@ -0,0 +1,60 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha256Test extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\OpenSSL
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('ES256', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\OpenSSL
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('sha256', $signer->getAlgorithm());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\OpenSSL
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getKeyLength
+     */
+    public function getKeyLengthMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals(64, $signer->getKeyLength());
+    }
+}

+ 60 - 0
vendor/qeq66/jwt/test/unit/Signer/Ecdsa/Sha384Test.php

@@ -0,0 +1,60 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha384Test extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\OpenSSL
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('ES384', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\OpenSSL
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('sha384', $signer->getAlgorithm());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\OpenSSL
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getKeyLength
+     */
+    public function getKeyLengthMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals(96, $signer->getKeyLength());
+    }
+}

+ 60 - 0
vendor/qeq66/jwt/test/unit/Signer/Ecdsa/Sha512Test.php

@@ -0,0 +1,60 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha512Test extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\OpenSSL
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('ES512', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\OpenSSL
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('sha512', $signer->getAlgorithm());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\OpenSSL
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getKeyLength
+     */
+    public function getKeyLengthMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals(132, $signer->getKeyLength());
+    }
+}

+ 117 - 0
vendor/qeq66/jwt/test/unit/Signer/EcdsaTest.php

@@ -0,0 +1,117 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use Lcobucci\JWT\Keys;
+use Lcobucci\JWT\Signer\Ecdsa\MultibyteStringConverter;
+use const OPENSSL_ALGO_SHA256;
+use function openssl_pkey_get_private;
+use function openssl_pkey_get_public;
+use function openssl_sign;
+use function openssl_verify;
+
+class EcdsaTest extends \PHPUnit\Framework\TestCase
+{
+    use Keys;
+
+    /**
+     * @var MultibyteStringConverter
+     */
+    private $pointsManipulator;
+
+    /**
+     * @before
+     */
+    public function createDependencies()
+    {
+        $this->pointsManipulator = new MultibyteStringConverter();
+    }
+
+    private function getSigner()
+    {
+        $signer = $this->getMockForAbstractClass(Ecdsa::class, [$this->pointsManipulator]);
+
+        $signer->method('getAlgorithm')
+            ->willReturn(OPENSSL_ALGO_SHA256);
+
+        $signer->method('getAlgorithmId')
+            ->willReturn('ES256');
+
+        $signer->method('getKeyLength')
+            ->willReturn(64);
+
+        return $signer;
+    }
+
+    /**
+     * @test
+     *
+     * @covers \Lcobucci\JWT\Signer\Ecdsa::createHash
+     * @covers \Lcobucci\JWT\Signer\Ecdsa::getKeyType
+     * @covers \Lcobucci\JWT\Signer\Ecdsa\MultibyteStringConverter
+     * @covers \Lcobucci\JWT\Signer\OpenSSL
+     * @covers \Lcobucci\JWT\Signer\BaseSigner
+     *
+     * @uses \Lcobucci\JWT\Signer\Ecdsa::__construct
+     * @uses \Lcobucci\JWT\Signer\Key
+     * @uses \Lcobucci\JWT\Signature
+     */
+    public function createHashShouldReturnTheAHashBasedOnTheOpenSslSignature()
+    {
+        $payload = 'testing';
+
+        $signer    = $this->getSigner();
+        $signature = $signer->sign($payload, self::$ecdsaKeys['private']);
+
+        $publicKey = openssl_pkey_get_public(self::$ecdsaKeys['public1']->getContent());
+
+        self::assertInternalType('resource', $publicKey);
+        self::assertSame(
+            1,
+            openssl_verify(
+                $payload,
+                $this->pointsManipulator->toAsn1($signature, $signer->getKeyLength()),
+                $publicKey,
+                OPENSSL_ALGO_SHA256
+            )
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @covers \Lcobucci\JWT\Signer\Ecdsa::doVerify
+     * @covers \Lcobucci\JWT\Signer\Ecdsa::getKeyType
+     * @covers \Lcobucci\JWT\Signer\Ecdsa\MultibyteStringConverter
+     * @covers \Lcobucci\JWT\Signer\OpenSSL
+     * @covers \Lcobucci\JWT\Signer\BaseSigner
+     *
+     * @uses \Lcobucci\JWT\Signer\Ecdsa::__construct
+     * @uses \Lcobucci\JWT\Signer\Key
+     */
+    public function doVerifyShouldDelegateToEcdsaSignerUsingPublicKey()
+    {
+        $payload    = 'testing';
+        $privateKey = openssl_pkey_get_private(self::$ecdsaKeys['private']->getContent());
+
+        self::assertInternalType('resource', $privateKey);
+
+        $signature = '';
+        openssl_sign($payload, $signature, $privateKey, OPENSSL_ALGO_SHA256);
+
+        $signer = $this->getSigner();
+
+        self::assertTrue(
+            $signer->verify(
+                $this->pointsManipulator->fromAsn1($signature, $signer->getKeyLength()),
+                $payload,
+                self::$ecdsaKeys['public1']
+            )
+        );
+    }
+}

+ 39 - 0
vendor/qeq66/jwt/test/unit/Signer/Hmac/Sha256Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Hmac;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Sha256Test extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha256::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('HS256', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha256::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('sha256', $signer->getAlgorithm());
+    }
+}

+ 39 - 0
vendor/qeq66/jwt/test/unit/Signer/Hmac/Sha384Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Hmac;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Sha384Test extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha384::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('HS384', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha384::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('sha384', $signer->getAlgorithm());
+    }
+}

+ 39 - 0
vendor/qeq66/jwt/test/unit/Signer/Hmac/Sha512Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Hmac;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Sha512Test extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha512::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('HS512', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha512::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('sha512', $signer->getAlgorithm());
+    }
+}

+ 134 - 0
vendor/qeq66/jwt/test/unit/Signer/HmacTest.php

@@ -0,0 +1,134 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class HmacTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @var Hmac|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $signer;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->signer = $this->getMockForAbstractClass(Hmac::class);
+
+        $this->signer->expects($this->any())
+                     ->method('getAlgorithmId')
+                     ->willReturn('TEST123');
+
+        $this->signer->expects($this->any())
+                     ->method('getAlgorithm')
+                     ->willReturn('sha256');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::createHash
+     */
+    public function createHashMustReturnAHashAccordingWithTheAlgorithm()
+    {
+        $hash = hash_hmac('sha256', 'test', '123', true);
+
+        $this->assertEquals($hash, $this->signer->createHash('test', new Key('123')));
+
+        return $hash;
+    }
+
+    /**
+     * @test
+     *
+     * @depends createHashMustReturnAHashAccordingWithTheAlgorithm
+     *
+     * @uses Lcobucci\JWT\Signer\Hmac::createHash
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::doVerify
+     */
+    public function doVerifyShouldReturnTrueWhenExpectedHashWasCreatedWithSameInformation($expected)
+    {
+        $this->assertTrue($this->signer->doVerify($expected, 'test', new Key('123')));
+    }
+
+    /**
+     * @test
+     *
+     * @depends createHashMustReturnAHashAccordingWithTheAlgorithm
+     *
+     * @uses Lcobucci\JWT\Signer\Hmac::createHash
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::doVerify
+     */
+    public function doVerifyShouldReturnFalseWhenExpectedHashWasNotCreatedWithSameInformation($expected)
+    {
+        $this->assertFalse($this->signer->doVerify($expected, 'test', new Key('1234')));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::doVerify
+     */
+    public function doVerifyShouldReturnFalseWhenExpectedHashIsNotString()
+    {
+        $this->assertFalse($this->signer->doVerify(false, 'test', new Key('1234')));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::hashEquals
+     */
+    public function hashEqualsShouldReturnFalseWhenExpectedHashHasDifferentLengthThanGenerated()
+    {
+        $this->assertFalse($this->signer->hashEquals('123', '1234'));
+    }
+
+    /**
+     * @test
+     *
+     * @depends createHashMustReturnAHashAccordingWithTheAlgorithm
+     *
+     * @uses Lcobucci\JWT\Signer\Hmac::createHash
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::hashEquals
+     */
+    public function hashEqualsShouldReturnFalseWhenExpectedHashIsDifferentThanGenerated($expected)
+    {
+        $this->assertFalse($this->signer->hashEquals($expected, $this->signer->createHash('test', new Key('1234'))));
+    }
+
+    /**
+     * @test
+     *
+     * @depends createHashMustReturnAHashAccordingWithTheAlgorithm
+     *
+     * @uses Lcobucci\JWT\Signer\Hmac::createHash
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::hashEquals
+     */
+    public function hashEqualsShouldReturnTrueWhenExpectedHashIsEqualsThanGenerated($expected)
+    {
+        $this->assertTrue($this->signer->hashEquals($expected, $this->signer->createHash('test', new Key('123'))));
+    }
+}

+ 119 - 0
vendor/qeq66/jwt/test/unit/Signer/KeyTest.php

@@ -0,0 +1,119 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use org\bovigo\vfs\vfsStream;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 3.0.4
+ */
+class KeyTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @before
+     */
+    public function configureRootDir()
+    {
+        vfsStream::setup(
+            'root',
+            null,
+            [
+                'test.pem' => 'testing',
+                'emptyFolder' => []
+            ]
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Key::__construct
+     * @covers Lcobucci\JWT\Signer\Key::setContent
+     */
+    public function constructShouldConfigureContentAndPassphrase()
+    {
+        $key = new Key('testing', 'test');
+
+        $this->assertAttributeEquals('testing', 'content', $key);
+        $this->assertAttributeEquals('test', 'passphrase', $key);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Key::__construct
+     * @covers Lcobucci\JWT\Signer\Key::setContent
+     * @covers Lcobucci\JWT\Signer\Key::readFile
+     */
+    public function constructShouldBeAbleToConfigureContentFromFile()
+    {
+        $key = new Key('file://' . vfsStream::url('root/test.pem'));
+
+        $this->assertAttributeEquals('testing', 'content', $key);
+        $this->assertAttributeEquals(null, 'passphrase', $key);
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @covers Lcobucci\JWT\Signer\Key::__construct
+     * @covers Lcobucci\JWT\Signer\Key::setContent
+     * @covers Lcobucci\JWT\Signer\Key::readFile
+     */
+    public function constructShouldRaiseExceptionWhenFileDoesNotExists()
+    {
+        new Key('file://' . vfsStream::url('root/test2.pem'));
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @covers Lcobucci\JWT\Signer\Key::__construct
+     * @covers Lcobucci\JWT\Signer\Key::setContent
+     * @covers Lcobucci\JWT\Signer\Key::readFile
+     */
+    public function constructShouldRaiseExceptionWhenFileGetContentsFailed()
+    {
+        new Key('file://' . vfsStream::url('root/emptyFolder'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key::__construct
+     * @uses Lcobucci\JWT\Signer\Key::setContent
+     *
+     * @covers Lcobucci\JWT\Signer\Key::getContent
+     */
+    public function getContentShouldReturnConfiguredData()
+    {
+        $key = new Key('testing', 'test');
+
+        $this->assertEquals('testing', $key->getContent());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key::__construct
+     * @uses Lcobucci\JWT\Signer\Key::setContent
+     *
+     * @covers Lcobucci\JWT\Signer\Key::getPassphrase
+     */
+    public function getPassphraseShouldReturnConfiguredData()
+    {
+        $key = new Key('testing', 'test');
+
+        $this->assertEquals('test', $key->getPassphrase());
+    }
+}

+ 49 - 0
vendor/qeq66/jwt/test/unit/Signer/KeychainTest.php

@@ -0,0 +1,49 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class KeychainTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Keychain::getPrivateKey
+     */
+    public function getPrivateKeyShouldReturnAKey()
+    {
+        $keychain = new Keychain();
+        $key = $keychain->getPrivateKey('testing', 'test');
+
+        $this->assertInstanceOf(Key::class, $key);
+        $this->assertAttributeEquals('testing', 'content', $key);
+        $this->assertAttributeEquals('test', 'passphrase', $key);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Keychain::getPublicKey
+     */
+    public function getPublicKeyShouldReturnAValidResource()
+    {
+        $keychain = new Keychain();
+        $key = $keychain->getPublicKey('testing');
+
+        $this->assertInstanceOf(Key::class, $key);
+        $this->assertAttributeEquals('testing', 'content', $key);
+        $this->assertAttributeEquals(null, 'passphrase', $key);
+    }
+}

+ 39 - 0
vendor/qeq66/jwt/test/unit/Signer/Rsa/Sha256Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Rsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha256Test extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('RS256', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals(OPENSSL_ALGO_SHA256, $signer->getAlgorithm());
+    }
+}

+ 39 - 0
vendor/qeq66/jwt/test/unit/Signer/Rsa/Sha384Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Rsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha384Test extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha384::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('RS384', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha384::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals(OPENSSL_ALGO_SHA384, $signer->getAlgorithm());
+    }
+}

+ 39 - 0
vendor/qeq66/jwt/test/unit/Signer/Rsa/Sha512Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Rsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha512Test extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha512::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('RS512', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha512::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals(OPENSSL_ALGO_SHA512, $signer->getAlgorithm());
+    }
+}

+ 188 - 0
vendor/qeq66/jwt/test/unit/Signer/RsaTest.php

@@ -0,0 +1,188 @@
+<?php
+namespace Lcobucci\JWT\Signer;
+
+use InvalidArgumentException;
+use Lcobucci\JWT\Keys;
+use PHPUnit\Framework\TestCase;
+use const OPENSSL_ALGO_SHA256;
+use function openssl_pkey_get_private;
+use function openssl_pkey_get_public;
+use function openssl_sign;
+use function openssl_verify;
+
+final class RsaTest extends TestCase
+{
+    use Keys;
+
+    /**
+     * @test
+     *
+     * @covers \Lcobucci\JWT\Signer\Rsa::createHash
+     * @covers \Lcobucci\JWT\Signer\Rsa::validateKey
+     * @covers \Lcobucci\JWT\Signer\Rsa::getKeyType
+     * @covers \Lcobucci\JWT\Signer\OpenSSL
+     * @covers \Lcobucci\JWT\Signer\BaseSigner
+     *
+     * @uses \Lcobucci\JWT\Signer\Key
+     * @uses \Lcobucci\JWT\Signature
+     */
+    public function createHashShouldReturnAValidOpensslSignature()
+    {
+        $payload = 'testing';
+
+        $signer    = $this->getSigner();
+        $signature = $signer->sign($payload, self::$rsaKeys['private']);
+
+        $publicKey = openssl_pkey_get_public(self::$rsaKeys['public']->getContent());
+        self::assertInternalType('resource', $publicKey);
+        self::assertSame(1, openssl_verify($payload, $signature, $publicKey, OPENSSL_ALGO_SHA256));
+    }
+
+    /**
+     * @test
+     *
+     * @covers \Lcobucci\JWT\Signer\Rsa::createHash
+     * @covers \Lcobucci\JWT\Signer\Rsa::validateKey
+     * @covers \Lcobucci\JWT\Signer\Rsa::getKeyType
+     * @covers \Lcobucci\JWT\Signer\OpenSSL
+     * @covers \Lcobucci\JWT\Signer\BaseSigner
+     *
+     * @uses \Lcobucci\JWT\Signer\Key
+     */
+    public function createHashShouldRaiseAnExceptionWhenKeyIsInvalid()
+    {
+        $key = <<<KEY
+-----BEGIN RSA PRIVATE KEY-----
+MGECAQACEQC4MRKSVsq5XnRBrJoX6+rnAgMBAAECECO8SZkgw6Yg66A6SUly/3kC
+CQDtPXZtCQWJuwIJAMbBu17GDOrFAggopfhNlFcjkwIIVjb7G+U0/TECCEERyvxP
+TWdN
+-----END RSA PRIVATE KEY-----
+KEY;
+
+        $signer = $this->getSigner();
+
+        $this->expectException(InvalidArgumentException::class);
+        $this->expectExceptionMessage('There was an error while creating the signature');
+
+        $signer->sign('testing', new Key($key));
+    }
+
+    /**
+     * @test
+     *
+     * @covers \Lcobucci\JWT\Signer\Rsa::createHash
+     * @covers \Lcobucci\JWT\Signer\Rsa::validateKey
+     * @covers \Lcobucci\JWT\Signer\OpenSSL
+     * @covers \Lcobucci\JWT\Signer\BaseSigner
+     *
+     * @uses \Lcobucci\JWT\Signer\Key
+     */
+    public function createHashShouldRaiseAnExceptionWhenKeyIsNotParseable()
+    {
+        $signer = $this->getSigner();
+
+        $this->expectException(InvalidArgumentException::class);
+        $this->expectExceptionMessage('It was not possible to parse your key');
+
+        $signer->sign('testing', new Key('blablabla'));
+    }
+
+    /**
+     * @test
+     *
+     * @covers \Lcobucci\JWT\Signer\Rsa::createHash
+     * @covers \Lcobucci\JWT\Signer\Rsa::validateKey
+     * @covers \Lcobucci\JWT\Signer\Rsa::getKeyType
+     * @covers \Lcobucci\JWT\Signer\OpenSSL
+     * @covers \Lcobucci\JWT\Signer\BaseSigner
+     *
+     * @uses \Lcobucci\JWT\Signer\Key
+     */
+    public function createHashShouldRaiseAnExceptionWhenKeyTypeIsNotRsa()
+    {
+        $signer = $this->getSigner();
+
+        $this->expectException(InvalidArgumentException::class);
+        $this->expectExceptionMessage('This key is not compatible with this signer');
+
+        $signer->sign('testing', self::$ecdsaKeys['private']);
+    }
+
+    /**
+     * @test
+     *
+     * @covers \Lcobucci\JWT\Signer\Rsa::doVerify
+     * @covers \Lcobucci\JWT\Signer\Rsa::validateKey
+     * @covers \Lcobucci\JWT\Signer\Rsa::getKeyType
+     * @covers \Lcobucci\JWT\Signer\OpenSSL
+     * @covers \Lcobucci\JWT\Signer\BaseSigner
+     *
+     * @uses \Lcobucci\JWT\Signer\Key
+     */
+    public function doVerifyShouldReturnTrueWhenSignatureIsValid()
+    {
+        $payload    = 'testing';
+        $privateKey = openssl_pkey_get_private(self::$rsaKeys['private']->getContent());
+        self::assertInternalType('resource', $privateKey);
+
+        $signature = '';
+        openssl_sign($payload, $signature, $privateKey, OPENSSL_ALGO_SHA256);
+
+        $signer = $this->getSigner();
+
+        self::assertTrue($signer->verify($signature, $payload, self::$rsaKeys['public']));
+    }
+
+    /**
+     * @test
+     *
+     * @covers \Lcobucci\JWT\Signer\Rsa::doVerify
+     * @covers \Lcobucci\JWT\Signer\Rsa::validateKey
+     * @covers \Lcobucci\JWT\Signer\OpenSSL
+     * @covers \Lcobucci\JWT\Signer\BaseSigner
+     *
+     * @uses \Lcobucci\JWT\Signer\Key
+     */
+    public function doVerifyShouldRaiseAnExceptionWhenKeyIsNotParseable()
+    {
+        $signer = $this->getSigner();
+
+        $this->expectException(InvalidArgumentException::class);
+        $this->expectExceptionMessage('It was not possible to parse your key');
+
+        $signer->verify('testing', 'testing', new Key('blablabla'));
+    }
+
+    /**
+     * @test
+     *
+     * @covers \Lcobucci\JWT\Signer\Rsa::doVerify
+     * @covers \Lcobucci\JWT\Signer\Rsa::validateKey
+     * @covers \Lcobucci\JWT\Signer\OpenSSL
+     * @covers \Lcobucci\JWT\Signer\BaseSigner
+     *
+     * @uses \Lcobucci\JWT\Signer\Key
+     */
+    public function doVerifyShouldRaiseAnExceptionWhenKeyTypeIsNotRsa()
+    {
+        $signer = $this->getSigner();
+
+        $this->expectException(InvalidArgumentException::class);
+        $this->expectExceptionMessage('It was not possible to parse your key');
+
+        $signer->verify('testing', 'testing', self::$ecdsaKeys['private']);
+    }
+
+    private function getSigner()
+    {
+        $signer = $this->getMockForAbstractClass(Rsa::class);
+
+        $signer->method('getAlgorithm')
+               ->willReturn(OPENSSL_ALGO_SHA256);
+
+        $signer->method('getAlgorithmId')
+               ->willReturn('RS256');
+
+        return $signer;
+    }
+}

+ 573 - 0
vendor/qeq66/jwt/test/unit/TokenTest.php

@@ -0,0 +1,573 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use DateInterval;
+use DateTime;
+use Lcobucci\JWT\Claim\Basic;
+use Lcobucci\JWT\Claim\EqualsTo;
+use Lcobucci\JWT\Claim\GreaterOrEqualsTo;
+use Lcobucci\JWT\Claim\LesserOrEqualsTo;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class TokenTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Token::__construct
+     */
+    public function constructMustInitializeAnEmptyPlainTextTokenWhenNoArgumentsArePassed()
+    {
+        $token = new Token();
+
+        $this->assertAttributeEquals(['alg' => 'none'], 'headers', $token);
+        $this->assertAttributeEquals([], 'claims', $token);
+        $this->assertAttributeEquals(null, 'signature', $token);
+        $this->assertAttributeEquals(['', ''], 'payload', $token);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::hasHeader
+     */
+    public function hasHeaderMustReturnTrueWhenItIsConfigured()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertTrue($token->hasHeader('test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::hasHeader
+     */
+    public function hasHeaderMustReturnFalseWhenItIsNotConfigured()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertFalse($token->hasHeader('testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasHeader
+     *
+     * @covers Lcobucci\JWT\Token::getHeader
+     *
+     * @expectedException \OutOfBoundsException
+     */
+    public function getHeaderMustRaiseExceptionWhenHeaderIsNotConfigured()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $token->getHeader('testing');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasHeader
+     *
+     * @covers Lcobucci\JWT\Token::getHeader
+     */
+    public function getHeaderMustReturnTheDefaultValueWhenIsNotConfigured()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertEquals('blah', $token->getHeader('testing', 'blah'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasHeader
+     *
+     * @covers Lcobucci\JWT\Token::getHeader
+     * @covers Lcobucci\JWT\Token::getHeaderValue
+     */
+    public function getHeaderMustReturnTheRequestedHeader()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertEquals('testing', $token->getHeader('test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasHeader
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::getHeader
+     * @covers Lcobucci\JWT\Token::getHeaderValue
+     */
+    public function getHeaderMustReturnValueWhenItIsAReplicatedClaim()
+    {
+        $token = new Token(['jti' => new EqualsTo('jti', 1)]);
+
+        $this->assertEquals(1, $token->getHeader('jti'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::getHeaders
+     */
+    public function getHeadersMustReturnTheConfiguredHeader()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertEquals(['test' => 'testing'], $token->getHeaders());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::getClaims
+     */
+    public function getClaimsMustReturnTheConfiguredClaims()
+    {
+        $token = new Token([], ['test' => 'testing']);
+
+        $this->assertEquals(['test' => 'testing'], $token->getClaims());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::hasClaim
+     */
+    public function hasClaimMustReturnTrueWhenItIsConfigured()
+    {
+        $token = new Token([], ['test' => new Basic('test', 'testing')]);
+
+        $this->assertTrue($token->hasClaim('test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::hasClaim
+     */
+    public function hasClaimMustReturnFalseWhenItIsNotConfigured()
+    {
+        $token = new Token([], ['test' => new Basic('test', 'testing')]);
+
+        $this->assertFalse($token->hasClaim('testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::getClaim
+     */
+    public function getClaimMustReturnTheDefaultValueWhenIsNotConfigured()
+    {
+        $token = new Token([], ['test' => new Basic('test', 'testing')]);
+
+        $this->assertEquals('blah', $token->getClaim('testing', 'blah'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::getClaim
+     *
+     * @expectedException \OutOfBoundsException
+     */
+    public function getClaimShouldRaiseExceptionWhenClaimIsNotConfigured()
+    {
+        $token = new Token();
+        $token->getClaim('testing');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::getClaim
+     */
+    public function getClaimShouldReturnTheClaimValueWhenItExists()
+    {
+        $token = new Token([], ['testing' => new Basic('testing', 'test')]);
+
+        $this->assertEquals('test', $token->getClaim('testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::verify
+     *
+     * @expectedException BadMethodCallException
+     */
+    public function verifyMustRaiseExceptionWhenTokenIsUnsigned()
+    {
+        $signer = $this->createMock(Signer::class);
+
+        $token = new Token();
+        $token->verify($signer, 'test');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::verify
+     * @covers Lcobucci\JWT\Token::getPayload
+     */
+    public function verifyShouldReturnFalseWhenTokenAlgorithmIsDifferent()
+    {
+        $signer = $this->createMock(Signer::class);
+        $signature = $this->createMock(Signature::class, [], [], '', false);
+
+        $signer->expects($this->any())
+               ->method('getAlgorithmId')
+               ->willReturn('HS256');
+
+        $signature->expects($this->never())
+                  ->method('verify');
+
+        $token = new Token(['alg' => 'RS256'], [], $signature);
+
+        $this->assertFalse($token->verify($signer, 'test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::verify
+     * @covers Lcobucci\JWT\Token::getPayload
+     */
+    public function verifyMustDelegateTheValidationToSignature()
+    {
+        $signer = $this->createMock(Signer::class);
+        $signature = $this->createMock(Signature::class, [], [], '', false);
+
+        $signer->expects($this->any())
+               ->method('getAlgorithmId')
+               ->willReturn('HS256');
+
+        $signature->expects($this->once())
+                  ->method('verify')
+                  ->with($signer, $this->isType('string'), 'test')
+                  ->willReturn(true);
+
+        $token = new Token(['alg' => 'HS256'], [], $signature);
+
+        $this->assertTrue($token->verify($signer, 'test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnTrueWhenClaimsAreEmpty()
+    {
+        $token = new Token();
+
+        $this->assertTrue($token->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnTrueWhenThereAreNoValidatableClaims()
+    {
+        $token = new Token([], ['testing' => new Basic('testing', 'test')]);
+
+        $this->assertTrue($token->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\EqualsTo
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnFalseWhenThereIsAtLeastOneFailedValidatableClaim()
+    {
+        $token = new Token(
+            [],
+            [
+                'iss' => new EqualsTo('iss', 'test'),
+                'testing' => new Basic('testing', 'test')
+            ]
+        );
+
+        $data = new ValidationData();
+        $data->setIssuer('test1');
+
+        $this->assertFalse($token->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\EqualsTo
+     * @uses Lcobucci\JWT\Claim\LesserOrEqualsTo
+     * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnFalseWhenATimeBasedClaimFails()
+    {
+        $now = time();
+
+        $token = new Token(
+            [],
+            [
+                'iss' => new EqualsTo('iss', 'test'),
+                'iat' => new LesserOrEqualsTo('iat', $now),
+                'nbf' => new LesserOrEqualsTo('nbf', $now + 20),
+                'exp' => new GreaterOrEqualsTo('exp', $now + 500),
+                'testing' => new Basic('testing', 'test')
+            ]
+        );
+
+        $data = new ValidationData($now + 10);
+        $data->setIssuer('test');
+
+        $this->assertFalse($token->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\EqualsTo
+     * @uses Lcobucci\JWT\Claim\LesserOrEqualsTo
+     * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnTrueWhenThereAreNoFailedValidatableClaims()
+    {
+        $now = time();
+
+        $token = new Token(
+            [],
+            [
+                'iss' => new EqualsTo('iss', 'test'),
+                'iat' => new LesserOrEqualsTo('iat', $now),
+                'exp' => new GreaterOrEqualsTo('exp', $now + 500),
+                'testing' => new Basic('testing', 'test')
+            ]
+        );
+
+        $data = new ValidationData($now + 10);
+        $data->setIssuer('test');
+
+        $this->assertTrue($token->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\EqualsTo
+     * @uses Lcobucci\JWT\Claim\LesserOrEqualsTo
+     * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnTrueWhenLeewayMakesAllTimeBasedClaimsTrueAndOtherClaimsAreTrue()
+    {
+        $now = time();
+
+        $token = new Token(
+            [],
+            [
+                'iss' => new EqualsTo('iss', 'test'),
+                'iat' => new LesserOrEqualsTo('iat', $now),
+                'nbf' => new LesserOrEqualsTo('nbf', $now + 20),
+                'exp' => new GreaterOrEqualsTo('exp', $now + 500),
+                'testing' => new Basic('testing', 'test')
+            ]
+        );
+
+        $data = new ValidationData($now + 10, 20);
+        $data->setIssuer('test');
+
+        $this->assertTrue($token->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Token::isExpired
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getClaim
+     * @uses Lcobucci\JWT\Token::hasClaim
+     */
+    public function isExpiredShouldReturnFalseWhenTokenDoesNotExpires()
+    {
+        $token = new Token(['alg' => 'none']);
+
+        $this->assertFalse($token->isExpired());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Token::isExpired
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getClaim
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     */
+    public function isExpiredShouldReturnFalseWhenTokenIsNotExpired()
+    {
+        $token = new Token(
+            ['alg' => 'none'],
+            ['exp' => new GreaterOrEqualsTo('exp', time() + 500)]
+        );
+
+        $this->assertFalse($token->isExpired());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Token::isExpired
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getClaim
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     */
+    public function isExpiredShouldReturnTrueAfterTokenExpires()
+    {
+        $token = new Token(
+            ['alg' => 'none'],
+            ['exp' => new GreaterOrEqualsTo('exp', time())]
+        );
+
+        $this->assertTrue($token->isExpired(new DateTime('+10 days')));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::getPayload
+     */
+    public function getPayloadShouldReturnAStringWithTheTwoEncodePartsThatGeneratedTheToken()
+    {
+        $token = new Token(['alg' => 'none'], [], null, ['test1', 'test2', 'test3']);
+
+        $this->assertEquals('test1.test2', $token->getPayload());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getPayload
+     *
+     * @covers Lcobucci\JWT\Token::__toString
+     */
+    public function toStringMustReturnEncodedDataWithEmptySignature()
+    {
+        $token = new Token(['alg' => 'none'], [], null, ['test', 'test']);
+
+        $this->assertEquals('test.test.', (string) $token);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getPayload
+     *
+     * @covers Lcobucci\JWT\Token::__toString
+     */
+    public function toStringMustReturnEncodedData()
+    {
+        $signature = $this->createMock(Signature::class, [], [], '', false);
+
+        $token = new Token(['alg' => 'none'], [], $signature, ['test', 'test', 'test']);
+
+        $this->assertEquals('test.test.test', (string) $token);
+    }
+}

+ 270 - 0
vendor/qeq66/jwt/test/unit/ValidationDataTest.php

@@ -0,0 +1,270 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class ValidationDataTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\ValidationData::__construct
+     * @covers Lcobucci\JWT\ValidationData::setCurrentTime
+     */
+    public function constructorShouldConfigureTheItems()
+    {
+        $expected = $this->createExpectedData();
+        $data = new ValidationData(1);
+
+        $this->assertAttributeSame($expected, 'items', $data);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\ValidationData::__construct
+     * @covers Lcobucci\JWT\ValidationData::setCurrentTime
+     */
+    public function constructorWithLeewayShouldConfigureTheItems()
+    {
+        $expected = $this->createExpectedData(null, null, null, null, 111, 111, 89);
+        $data = new ValidationData(100, 11);
+
+        $this->assertAttributeSame($expected, 'items', $data);
+    }
+
+    /**
+     * @test
+     *
+     * @dataProvider claimValues
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::setId
+     */
+    public function setIdShouldChangeTheId($id)
+    {
+        $expected = $this->createExpectedData($id);
+        $data = new ValidationData(1);
+        $data->setId($id);
+
+        $this->assertAttributeSame($expected, 'items', $data);
+    }
+
+    /**
+     * @test
+     *
+     * @dataProvider claimValues
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::setIssuer
+     */
+    public function setIssuerShouldChangeTheIssuer($iss)
+    {
+        $expected = $this->createExpectedData(null, null, $iss);
+        $data = new ValidationData(1);
+        $data->setIssuer($iss);
+
+        $this->assertAttributeSame($expected, 'items', $data);
+    }
+
+    /**
+     * @test
+     *
+     * @dataProvider claimValues
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::setAudience
+     */
+    public function setAudienceShouldChangeTheAudience($aud)
+    {
+        $expected = $this->createExpectedData(null, null, null, $aud);
+        $data = new ValidationData(1);
+        $data->setAudience($aud);
+
+        $this->assertAttributeSame($expected, 'items', $data);
+    }
+
+    /**
+     * @test
+     *
+     * @dataProvider claimValues
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::setSubject
+     */
+    public function setSubjectShouldChangeTheSubject($sub)
+    {
+        $expected = $this->createExpectedData(null, $sub);
+        $data = new ValidationData(1);
+        $data->setSubject($sub);
+
+        $this->assertAttributeSame($expected, 'items', $data);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::setCurrentTime
+     */
+    public function setCurrentTimeShouldChangeTheTimeBasedValues()
+    {
+        $expected = $this->createExpectedData(null, null, null, null, 2);
+        $data = new ValidationData(1);
+        $data->setCurrentTime(2);
+
+        $this->assertAttributeSame($expected, 'items', $data);
+    }
+
+    /**
+     * @test
+     *
+     * @uses   Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::setCurrentTime
+     */
+    public function setCurrentTimeShouldChangeTheTimeBasedValuesUsingLeeway()
+    {
+        $expected = $this->createExpectedData(null, null, null, null, 30, 30, 10);
+        $data = new ValidationData(15, 10);
+        $data->setCurrentTime(20);
+
+        $this->assertAttributeSame($expected, 'items', $data);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::has
+     */
+    public function hasShouldReturnTrueWhenItemIsNotEmpty()
+    {
+        $data = new ValidationData(1);
+
+        $this->assertTrue($data->has('iat'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::has
+     */
+    public function hasShouldReturnFalseWhenItemIsEmpty()
+    {
+        $data = new ValidationData(1);
+
+        $this->assertFalse($data->has('jti'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::has
+     */
+    public function hasShouldReturnFalseWhenItemIsNotDefined()
+    {
+        $data = new ValidationData(1);
+
+        $this->assertFalse($data->has('test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::get
+     */
+    public function getShouldReturnTheItemValue()
+    {
+        $data = new ValidationData(1);
+
+        $this->assertEquals(1, $data->get('iat'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setCurrentTime
+     *
+     * @covers Lcobucci\JWT\ValidationData::get
+     */
+    public function getShouldReturnNullWhenItemIsNotDefined()
+    {
+        $data = new ValidationData(1);
+
+        $this->assertNull($data->get('test'));
+    }
+
+    /**
+     * @return array
+     */
+    public function claimValues()
+    {
+        return [
+            [1],
+            ['test']
+        ];
+    }
+
+    /**
+     * @param string|null $id
+     * @param string|null $sub
+     * @param string|null $iss
+     * @param string|null $aud
+     * @param int $iat
+     * @param int|null $nbf
+     * @param int|null $exp
+     *
+     * @return array
+     */
+    private function createExpectedData(
+        $id = null,
+        $sub = null,
+        $iss = null,
+        $aud = null,
+        $iat = 1,
+        $nbf = null,
+        $exp = null
+    ) {
+        return [
+            'jti' => $id !== null ? (string) $id : null,
+            'iss' => $iss !== null ? (string) $iss : null,
+            'aud' => $aud !== null ? (string) $aud : null,
+            'sub' => $sub !== null ? (string) $sub : null,
+            'iat' => $iat,
+            'nbf' => $nbf !== null ? $nbf: $iat,
+            'exp' => $exp !== null ? $exp: $iat
+        ];
+    }
+}