Updated unit tests

This commit is contained in:
Alex Bilbie
2012-12-23 22:11:33 +00:00
parent 38c50c00b0
commit 6eeb7e13e4
2 changed files with 29 additions and 6 deletions
+20 -4
View File
@@ -4,8 +4,8 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
{
public function setUp()
{
require 'src/OAuth2/Authentication/Server.php';
require 'src/OAuth2/Authentication/Database.php';
require_once 'src/OAuth2/Authentication/Server.php';
require_once 'src/OAuth2/Authentication/Database.php';
$this->oauth = new Oauth2\Authentication\Server();
@@ -49,6 +49,12 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
$expect = array(
'client_id' => 'test',
'redirect_uri' => 'http://example.com/test',
'client_details' => array(
'client_id' => 'test',
'client_secret' => 'test',
'redirect_uri' => 'http://example.com/test',
'name' => 'Test Client'
),
'response_type' => 'code',
'scopes' => array(
0 => array(
@@ -82,6 +88,12 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
$this->assertEquals(array(
'client_id' => 'test',
'redirect_uri' => 'http://example.com/test',
'client_details' => array(
'client_id' => 'test',
'client_secret' => 'test',
'redirect_uri' => 'http://example.com/test',
'name' => 'Test Client'
),
'response_type' => 'code',
'scopes' => array(0 => array(
'id' => 1,
@@ -216,10 +228,12 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
$result = $this->oauth->issueAccessToken();
$this->assertCount(3, $result);
$this->assertCount(5, $result);
$this->assertArrayHasKey('access_token', $result);
$this->assertArrayHasKey('token_type', $result);
$this->assertArrayHasKey('expires_in', $result);
$this->assertArrayHasKey('expires', $result);
$this->assertArrayHasKey('refresh_token', $result);
}
public function test_issueAccessToken_PassedParams()
@@ -243,10 +257,12 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
$result = $this->oauth->issueAccessToken($params);
$this->assertCount(3, $result);
$this->assertCount(5, $result);
$this->assertArrayHasKey('access_token', $result);
$this->assertArrayHasKey('token_type', $result);
$this->assertArrayHasKey('expires_in', $result);
$this->assertArrayHasKey('expires', $result);
$this->assertArrayHasKey('refresh_token', $result);
}
/**