mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-26 16:52:04 +05:30
Add test for previous exceptions
This commit is contained in:
parent
9542af627e
commit
5868996961
@ -2,6 +2,7 @@
|
||||
|
||||
namespace LeagueTests\Exception;
|
||||
|
||||
use Exception;
|
||||
use League\OAuth2\Server\Exception\OAuthServerException;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@ -20,4 +21,19 @@ class OAuthServerExceptionTest extends TestCase
|
||||
|
||||
$this->assertFalse($exceptionWithoutRedirect->hasRedirect());
|
||||
}
|
||||
|
||||
public function testHasPrevious()
|
||||
{
|
||||
$previous = new Exception('This is the previous');
|
||||
$exceptionWithPrevious = OAuthServerException::accessDenied(null, null, $previous);
|
||||
|
||||
$this->assertSame('This is the previous', $exceptionWithPrevious->getPrevious()->getMessage());
|
||||
}
|
||||
|
||||
public function testDoesNotHavePrevious()
|
||||
{
|
||||
$exceptionWithoutPrevious = OAuthServerException::accessDenied();
|
||||
|
||||
$this->assertNull($exceptionWithoutPrevious->getPrevious());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user