From 677c10a61d0f08e5ba33c42510f2889d134c69ae Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Fri, 23 Aug 2019 00:15:10 +0300 Subject: [PATCH] Add tests --- tests/Exception/OAuthServerExceptionTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/Exception/OAuthServerExceptionTest.php b/tests/Exception/OAuthServerExceptionTest.php index eb2b2ad3..2016c631 100644 --- a/tests/Exception/OAuthServerExceptionTest.php +++ b/tests/Exception/OAuthServerExceptionTest.php @@ -71,6 +71,14 @@ class OAuthServerExceptionTest extends TestCase $exceptionWithRedirect = OAuthServerException::accessDenied('some hint', 'https://example.com/error'); $this->assertTrue($exceptionWithRedirect->hasRedirect()); + $this->assertSame( + 'https://example.com/error?error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request.&hint=some+hint&message=The+resource+owner+or+authorization+server+denied+the+request.', + $exceptionWithRedirect->getRedirectUri() + ); + $this->assertSame( + 'https://example.com/error#error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request.&hint=some+hint&message=The+resource+owner+or+authorization+server+denied+the+request.', + $exceptionWithRedirect->getRedirectUri(true) + ); } public function testDoesNotHaveRedirect() @@ -78,6 +86,7 @@ class OAuthServerExceptionTest extends TestCase $exceptionWithoutRedirect = OAuthServerException::accessDenied('Some hint'); $this->assertFalse($exceptionWithoutRedirect->hasRedirect()); + $this->assertNull($exceptionWithoutRedirect->getRedirectUri()); } public function testHasPrevious()