Laravel version update
Laravel version update
This commit is contained in:
128
vendor/lcobucci/jwt/test/unit/Signer/BaseSignerTest.php
vendored
Normal file
128
vendor/lcobucci/jwt/test/unit/Signer/BaseSignerTest.php
vendored
Normal file
@@ -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'));
|
||||
}
|
||||
}
|
||||
178
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/KeyParserTest.php
vendored
Normal file
178
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/KeyParserTest.php
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
<?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;
|
||||
|
||||
use Mdanter\Ecc\Crypto\Key\PrivateKeyInterface;
|
||||
use Mdanter\Ecc\Crypto\Key\PublicKeyInterface;
|
||||
use Mdanter\Ecc\Math\MathAdapterInterface;
|
||||
use Mdanter\Ecc\Serializer\PrivateKey\PrivateKeySerializerInterface;
|
||||
use Mdanter\Ecc\Serializer\PublicKey\PublicKeySerializerInterface;
|
||||
use Lcobucci\JWT\Signer\Key;
|
||||
|
||||
/**
|
||||
* @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
|
||||
* @since 3.0.4
|
||||
*/
|
||||
class KeyParserTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var MathAdapterInterface|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $adapter;
|
||||
|
||||
/**
|
||||
* @var PrivateKeySerializerInterface|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $privateKeySerializer;
|
||||
|
||||
/**
|
||||
* @var PublicKeySerializerInterface|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $publicKeySerializer;
|
||||
|
||||
/**
|
||||
* @before
|
||||
*/
|
||||
public function createDependencies()
|
||||
{
|
||||
$this->adapter = $this->getMock(MathAdapterInterface::class);
|
||||
$this->privateKeySerializer = $this->getMock(PrivateKeySerializerInterface::class);
|
||||
$this->publicKeySerializer = $this->getMock(PublicKeySerializerInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
|
||||
*/
|
||||
public function constructShouldConfigureDependencies()
|
||||
{
|
||||
$parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
|
||||
|
||||
$this->assertAttributeSame($this->privateKeySerializer, 'privateKeySerializer', $parser);
|
||||
$this->assertAttributeSame($this->publicKeySerializer, 'publicKeySerializer', $parser);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
|
||||
* @uses Lcobucci\JWT\Signer\Key
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPrivateKey
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent
|
||||
*/
|
||||
public function getPrivateKeyShouldAskSerializerToParseTheKey()
|
||||
{
|
||||
$privateKey = $this->getMock(PrivateKeyInterface::class);
|
||||
|
||||
$keyContent = 'MHcCAQEEIBGpMoZJ64MMSzuo5JbmXpf9V4qSWdLIl/8RmJLcfn/qoAoGC'
|
||||
. 'CqGSM49AwEHoUQDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpnd0wxa2iF'
|
||||
. 'ruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==';
|
||||
|
||||
$this->privateKeySerializer->expects($this->once())
|
||||
->method('parse')
|
||||
->with($keyContent)
|
||||
->willReturn($privateKey);
|
||||
|
||||
$parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
|
||||
$this->assertSame($privateKey, $parser->getPrivateKey($this->getPrivateKey()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @expectedException \InvalidArgumentException
|
||||
*
|
||||
* @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
|
||||
* @uses Lcobucci\JWT\Signer\Key
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPrivateKey
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent
|
||||
*/
|
||||
public function getPrivateKeyShouldRaiseExceptionWhenAWrongKeyWasGiven()
|
||||
{
|
||||
$this->privateKeySerializer->expects($this->never())
|
||||
->method('parse');
|
||||
|
||||
$parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
|
||||
$parser->getPrivateKey($this->getPublicKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
|
||||
* @uses Lcobucci\JWT\Signer\Key
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPublicKey
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent
|
||||
*/
|
||||
public function getPublicKeyShouldAskSerializerToParseTheKey()
|
||||
{
|
||||
$publicKey = $this->getMock(PublicKeyInterface::class);
|
||||
|
||||
$keyContent = 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpn'
|
||||
. 'd0wxa2iFruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==';
|
||||
|
||||
$this->publicKeySerializer->expects($this->once())
|
||||
->method('parse')
|
||||
->with($keyContent)
|
||||
->willReturn($publicKey);
|
||||
|
||||
$parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
|
||||
$this->assertSame($publicKey, $parser->getPublicKey($this->getPublicKey()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @expectedException \InvalidArgumentException
|
||||
*
|
||||
* @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
|
||||
* @uses Lcobucci\JWT\Signer\Key
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPublicKey
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent
|
||||
*/
|
||||
public function getPublicKeyShouldRaiseExceptionWhenAWrongKeyWasGiven()
|
||||
{
|
||||
$this->publicKeySerializer->expects($this->never())
|
||||
->method('parse');
|
||||
|
||||
$parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
|
||||
$parser->getPublicKey($this->getPrivateKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Key
|
||||
*/
|
||||
private function getPrivateKey()
|
||||
{
|
||||
return new Key(
|
||||
"-----BEGIN EC PRIVATE KEY-----\n"
|
||||
. "MHcCAQEEIBGpMoZJ64MMSzuo5JbmXpf9V4qSWdLIl/8RmJLcfn/qoAoGCCqGSM49\n"
|
||||
. "AwEHoUQDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpnd0wxa2iFruiI2tsEdGFTLTsy\n"
|
||||
. "U+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==\n"
|
||||
. "-----END EC PRIVATE KEY-----"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Key
|
||||
*/
|
||||
private function getPublicKey()
|
||||
{
|
||||
return new Key(
|
||||
"-----BEGIN PUBLIC KEY-----\n"
|
||||
. "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpn\n"
|
||||
. "d0wxa2iFruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==\n"
|
||||
. "-----END PUBLIC KEY-----"
|
||||
);
|
||||
}
|
||||
}
|
||||
60
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha256Test.php
vendored
Normal file
60
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha256Test.php
vendored
Normal file
@@ -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\Ecdsa\KeyParser
|
||||
*
|
||||
* @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\Ecdsa\KeyParser
|
||||
*
|
||||
* @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\Ecdsa\KeyParser
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getSignatureLength
|
||||
*/
|
||||
public function getSignatureLengthMustBeCorrect()
|
||||
{
|
||||
$signer = new Sha256();
|
||||
|
||||
$this->assertEquals(64, $signer->getSignatureLength());
|
||||
}
|
||||
}
|
||||
60
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha384Test.php
vendored
Normal file
60
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha384Test.php
vendored
Normal file
@@ -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\Ecdsa\KeyParser
|
||||
*
|
||||
* @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\Ecdsa\KeyParser
|
||||
*
|
||||
* @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\Ecdsa\KeyParser
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getSignatureLength
|
||||
*/
|
||||
public function getSignatureLengthMustBeCorrect()
|
||||
{
|
||||
$signer = new Sha384();
|
||||
|
||||
$this->assertEquals(96, $signer->getSignatureLength());
|
||||
}
|
||||
}
|
||||
60
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha512Test.php
vendored
Normal file
60
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha512Test.php
vendored
Normal file
@@ -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\Ecdsa\KeyParser
|
||||
*
|
||||
* @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\Ecdsa\KeyParser
|
||||
*
|
||||
* @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\Ecdsa\KeyParser
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getSignatureLength
|
||||
*/
|
||||
public function getSignatureLengthMustBeCorrect()
|
||||
{
|
||||
$signer = new Sha512();
|
||||
|
||||
$this->assertEquals(132, $signer->getSignatureLength());
|
||||
}
|
||||
}
|
||||
173
vendor/lcobucci/jwt/test/unit/Signer/EcdsaTest.php
vendored
Normal file
173
vendor/lcobucci/jwt/test/unit/Signer/EcdsaTest.php
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
<?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\Signer\Ecdsa\KeyParser;
|
||||
use Mdanter\Ecc\Crypto\Signature\Signature;
|
||||
use Mdanter\Ecc\Crypto\Signature\Signer;
|
||||
use Mdanter\Ecc\Crypto\Key\PrivateKeyInterface;
|
||||
use Mdanter\Ecc\Crypto\Key\PublicKeyInterface;
|
||||
use Mdanter\Ecc\Math\MathAdapterInterface as Adapter;
|
||||
use Mdanter\Ecc\Primitives\PointInterface;
|
||||
use Mdanter\Ecc\Random\RandomNumberGeneratorInterface;
|
||||
|
||||
/**
|
||||
* @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
|
||||
* @since 2.1.0
|
||||
*/
|
||||
class EcdsaTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var Adapter|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $adapter;
|
||||
|
||||
/**
|
||||
* @var Signer|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $signer;
|
||||
|
||||
/**
|
||||
* @var RandomNumberGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $randomGenerator;
|
||||
|
||||
/**
|
||||
* @var KeyParser|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $parser;
|
||||
|
||||
/**
|
||||
* @before
|
||||
*/
|
||||
public function createDependencies()
|
||||
{
|
||||
$this->adapter = $this->getMock(Adapter::class);
|
||||
$this->signer = $this->getMock(Signer::class, [], [$this->adapter]);
|
||||
$this->randomGenerator = $this->getMock(RandomNumberGeneratorInterface::class);
|
||||
$this->parser = $this->getMock(KeyParser::class, [], [], '', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Ecdsa
|
||||
*/
|
||||
private function getSigner()
|
||||
{
|
||||
$signer = $this->getMockForAbstractClass(
|
||||
Ecdsa::class,
|
||||
[$this->adapter, $this->signer, $this->parser]
|
||||
);
|
||||
|
||||
$signer->method('getSignatureLength')
|
||||
->willReturn(64);
|
||||
|
||||
$signer->method('getAlgorithm')
|
||||
->willReturn('sha256');
|
||||
|
||||
$signer->method('getAlgorithmId')
|
||||
->willReturn('ES256');
|
||||
|
||||
return $signer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa::__construct
|
||||
*/
|
||||
public function constructShouldConfigureDependencies()
|
||||
{
|
||||
$signer = $this->getSigner();
|
||||
|
||||
$this->assertAttributeSame($this->adapter, 'adapter', $signer);
|
||||
$this->assertAttributeSame($this->signer, 'signer', $signer);
|
||||
$this->assertAttributeSame($this->parser, 'parser', $signer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @uses Lcobucci\JWT\Signer\Ecdsa::__construct
|
||||
* @uses Lcobucci\JWT\Signer\Key
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa::createHash
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa::createSigningHash
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa::createSignatureHash
|
||||
*/
|
||||
public function createHashShouldReturnAHashUsingPrivateKey()
|
||||
{
|
||||
$signer = $this->getSigner();
|
||||
$key = new Key('testing');
|
||||
$privateKey = $this->getMock(PrivateKeyInterface::class);
|
||||
$point = $this->getMock(PointInterface::class);
|
||||
|
||||
$privateKey->method('getPoint')
|
||||
->willReturn($point);
|
||||
|
||||
$point->method('getOrder')
|
||||
->willReturn('1');
|
||||
|
||||
$this->parser->expects($this->once())
|
||||
->method('getPrivateKey')
|
||||
->with($key)
|
||||
->willReturn($privateKey);
|
||||
|
||||
$this->randomGenerator->expects($this->once())
|
||||
->method('generate')
|
||||
->with('1')
|
||||
->willReturn('123');
|
||||
|
||||
$this->adapter->expects($this->once())
|
||||
->method('hexDec')
|
||||
->willReturn('123');
|
||||
|
||||
$this->adapter->expects($this->exactly(2))
|
||||
->method('decHex')
|
||||
->willReturn('123');
|
||||
|
||||
$this->signer->expects($this->once())
|
||||
->method('sign')
|
||||
->with($privateKey, $this->isType('string'), $this->isType('string'))
|
||||
->willReturn(new Signature('1234', '456'));
|
||||
|
||||
$this->assertInternalType('string', $signer->createHash('testing', $key, $this->randomGenerator));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @uses Lcobucci\JWT\Signer\Ecdsa::__construct
|
||||
* @uses Lcobucci\JWT\Signer\Key
|
||||
*
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa::doVerify
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa::createSigningHash
|
||||
* @covers Lcobucci\JWT\Signer\Ecdsa::extractSignature
|
||||
*/
|
||||
public function doVerifyShouldDelegateToEcdsaSignerUsingPublicKey()
|
||||
{
|
||||
$signer = $this->getSigner();
|
||||
$key = new Key('testing');
|
||||
$publicKey = $this->getMock(PublicKeyInterface::class);
|
||||
|
||||
$this->parser->expects($this->once())
|
||||
->method('getPublicKey')
|
||||
->with($key)
|
||||
->willReturn($publicKey);
|
||||
|
||||
$this->adapter->expects($this->exactly(3))
|
||||
->method('hexDec')
|
||||
->willReturn('123');
|
||||
|
||||
$this->signer->expects($this->once())
|
||||
->method('verify')
|
||||
->with($publicKey, $this->isInstanceOf(Signature::class), $this->isType('string'))
|
||||
->willReturn(true);
|
||||
|
||||
$this->assertTrue($signer->doVerify('testing', 'testing2', $key));
|
||||
}
|
||||
}
|
||||
39
vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha256Test.php
vendored
Normal file
39
vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha256Test.php
vendored
Normal file
@@ -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
vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha384Test.php
vendored
Normal file
39
vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha384Test.php
vendored
Normal file
@@ -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
vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha512Test.php
vendored
Normal file
39
vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha512Test.php
vendored
Normal file
@@ -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
vendor/lcobucci/jwt/test/unit/Signer/HmacTest.php
vendored
Normal file
134
vendor/lcobucci/jwt/test/unit/Signer/HmacTest.php
vendored
Normal file
@@ -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
vendor/lcobucci/jwt/test/unit/Signer/KeyTest.php
vendored
Normal file
119
vendor/lcobucci/jwt/test/unit/Signer/KeyTest.php
vendored
Normal file
@@ -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
vendor/lcobucci/jwt/test/unit/Signer/KeychainTest.php
vendored
Normal file
49
vendor/lcobucci/jwt/test/unit/Signer/KeychainTest.php
vendored
Normal file
@@ -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
vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha256Test.php
vendored
Normal file
39
vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha256Test.php
vendored
Normal file
@@ -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
vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha384Test.php
vendored
Normal file
39
vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha384Test.php
vendored
Normal file
@@ -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
vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha512Test.php
vendored
Normal file
39
vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha512Test.php
vendored
Normal file
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user