mirror of
				https://github.com/elyby/oauth2-server.git
				synced 2025-05-31 14:12:07 +05:30 
			
		
		
		
	Add test for previous exceptions
This commit is contained in:
		@@ -2,6 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace LeagueTests\Exception;
 | 
					namespace LeagueTests\Exception;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Exception;
 | 
				
			||||||
use League\OAuth2\Server\Exception\OAuthServerException;
 | 
					use League\OAuth2\Server\Exception\OAuthServerException;
 | 
				
			||||||
use PHPUnit\Framework\TestCase;
 | 
					use PHPUnit\Framework\TestCase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -20,4 +21,19 @@ class OAuthServerExceptionTest extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $this->assertFalse($exceptionWithoutRedirect->hasRedirect());
 | 
					        $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());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user