mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Improved tests to increase MSI to 70%
This commit is contained in:
31
module/Rest/test/Exception/AuthenticationExceptionTest.php
Normal file
31
module/Rest/test/Exception/AuthenticationExceptionTest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\Rest\Exception;
|
||||
|
||||
use Exception;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Rest\Exception\AuthenticationException;
|
||||
use Throwable;
|
||||
|
||||
class AuthenticationExceptionTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider providePrev
|
||||
*/
|
||||
public function expiredJWTCreatesExpectedException(?Throwable $prev): void
|
||||
{
|
||||
$e = AuthenticationException::expiredJWT($prev);
|
||||
|
||||
$this->assertEquals($prev, $e->getPrevious());
|
||||
$this->assertEquals(-1, $e->getCode());
|
||||
$this->assertEquals('The token has expired.', $e->getMessage());
|
||||
}
|
||||
|
||||
public function providePrev()
|
||||
{
|
||||
yield 'with previous exception' => [new Exception('Prev')];
|
||||
yield 'without previous exception' => [null];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user