Skip to content

Commit

Permalink
Updated sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbilbie committed May 11, 2013
1 parent 86fb02d commit f5251a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/authorization/AuthCodeGrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ function test_newAuthoriseRequest()
$this->session->shouldReceive('createSession')->andReturn(1);
$this->session->shouldReceive('associateScope')->andReturn(null);
$this->session->shouldReceive('associateRedirectUri')->andReturn(null);
$this->session->shouldReceive('associateAuthCode')->andReturn(null);
$this->session->shouldReceive('associateAuthCode')->andReturn(1);
$this->session->shouldReceive('associateAuthCodeScope')->andReturn(null);

$a = $this->returnDefault();
$g = new League\OAuth2\Server\Grant\AuthCode($a);
Expand Down
11 changes: 9 additions & 2 deletions tests/authorization/AuthServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,14 @@ public function test_issueAccessToken_passedInput()
));

$this->session->shouldReceive('validateAuthCode')->andReturn(array(
'id' => 1,
'scope_ids' => '1'
'session_id' => 1,
'authcode_id' => 1
));
$this->session->shouldReceive('updateSession')->andReturn(null);
$this->session->shouldReceive('removeAuthCode')->andReturn(null);
$this->session->shouldReceive('associateAccessToken')->andReturn(1);
$this->session->shouldReceive('associateScope')->andReturn(null);
$this->session->shouldReceive('getAuthCodeScopes')->andReturn(array('scope_id' => 1));

$a = $this->returnDefault();
$a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
Expand Down Expand Up @@ -399,6 +400,8 @@ public function test_issueAccessToken()
$this->session->shouldReceive('updateSession')->andReturn(null);
$this->session->shouldReceive('removeAuthCode')->andReturn(null);
$this->session->shouldReceive('associateAccessToken')->andReturn(1);
$this->session->shouldReceive('getAuthCodeScopes')->andReturn(array('scope_id' => 1));
$this->session->shouldReceive('associateScope')->andReturn(null);

$a = $this->returnDefault();
$a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
Expand Down Expand Up @@ -436,6 +439,8 @@ public function test_issueAccessToken_customExpiresIn()
$this->session->shouldReceive('updateSession')->andReturn(null);
$this->session->shouldReceive('removeAuthCode')->andReturn(null);
$this->session->shouldReceive('associateAccessToken')->andReturn(1);
$this->session->shouldReceive('getAuthCodeScopes')->andReturn(array('scope_id' => 1));
$this->session->shouldReceive('associateScope')->andReturn(null);

$a = $this->returnDefault();
$grant = new League\OAuth2\Server\Grant\AuthCode($a);
Expand Down Expand Up @@ -477,6 +482,8 @@ public function test_issueAccessToken_HTTP_auth()
$this->session->shouldReceive('updateSession')->andReturn(null);
$this->session->shouldReceive('removeAuthCode')->andReturn(null);
$this->session->shouldReceive('associateAccessToken')->andReturn(1);
$this->session->shouldReceive('getAuthCodeScopes')->andReturn(array('scope_id' => 1));
$this->session->shouldReceive('associateScope')->andReturn(null);

$a = $this->returnDefault();
$a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
Expand Down
2 changes: 2 additions & 0 deletions tests/authorization/RefreshTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function test_issueAccessToken_with_refresh_token()
$this->session->shouldReceive('removeAuthCode')->andReturn(null);
$this->session->shouldReceive('associateAccessToken')->andReturn(1);
$this->session->shouldReceive('associateRefreshToken')->andReturn(1);
$this->session->shouldReceive('associateScope')->andReturn(null);
$this->session->shouldReceive('getAuthCodeScopes')->andReturn(array('scope_id' => 1));

$a = $this->returnDefault();
$a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
Expand Down

0 comments on commit f5251a6

Please sign in to comment.