Lots of fixes for tests following exceptions changes

This commit is contained in:
Alex Bilbie
2014-05-01 14:33:11 +01:00
parent 9f1f0cc3bc
commit 1183fe80c6
8 changed files with 47 additions and 111 deletions

View File

@@ -9,7 +9,6 @@ use League\OAuth2\Server\Entity\AccessToken;
use League\OAuth2\Server\Entity\Session;
use League\OAuth2\Server\Entity\RefreshToken as RT;
use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Grant\ClientException;
use Mockery as M;
class RefreshTokenTest extends \PHPUnit_Framework_TestCase
@@ -27,7 +26,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
function testCompleteFlowMissingClientId()
{
$this->setExpectedException('League\OAuth2\Server\Exception\ClientException', 'The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "client_id" parameter.');
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
$_POST['grant_type'] = 'refresh_token';
@@ -40,7 +39,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
function testCompleteFlowMissingClientSecret()
{
$this->setExpectedException('League\OAuth2\Server\Exception\ClientException', 'The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "client_secret" parameter.');
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
$_POST = [
'grant_type' => 'refresh_token',
@@ -56,7 +55,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
function testCompleteFlowInvalidClient()
{
$this->setExpectedException('League\OAuth2\Server\Exception\ClientException', 'Client authentication failed');
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException');
$_POST = [
'grant_type' => 'refresh_token',
@@ -79,7 +78,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
function testCompleteFlowMissingRefreshToken()
{
$this->setExpectedException('League\OAuth2\Server\Exception\ClientException', 'The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "refresh_token" parameter.');
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
$_POST = [
'grant_type' => 'refresh_token',
@@ -113,7 +112,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
function testCompleteFlowInvalidRefreshToken()
{
$this->setExpectedException('League\OAuth2\Server\Exception\ClientException', 'The refresh token is invalid.');
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRefreshException');
$_POST = [
'grant_type' => 'refresh_token',
@@ -352,7 +351,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
$server->addGrantType($grant);
$this->setExpectedException('League\OAuth2\Server\Exception\ClientException', 'The requested scope is invalid, unknown, or malformed. Check the "blah" scope.');
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidScopeException');
$server->issueAccessToken();
}