Skip to content

Commit

Permalink
fixed refresh token to set access token
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkit committed Sep 11, 2014
1 parent 29835e5 commit 6493aca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Storage/FluentRefreshToken.php
Expand Up @@ -35,6 +35,7 @@ public function get($token)

return (new RefreshTokenEntity($this->getServer()))
->setId($result->id)
->setAccessTokenId($result->access_token_id)
->setExpireTime((int)$result->expire_time);
}

Expand All @@ -57,6 +58,7 @@ public function create($token, $expireTime, $accessToken)

return (new RefreshTokenEntity($this->getServer()))
->setId($token)
->setAccessTokenId($accessToken)
->setExpireTime((int)$expireTime);
}

Expand Down
6 changes: 5 additions & 1 deletion tests/integration/FluentRefreshTokenTest.php
Expand Up @@ -7,7 +7,7 @@ class FluentRefreshTokenTest extends DBTestCase
{
public function getRefreshTokenRepository()
{
$server = m::mock('League\OAuth2\Server\AbstractServer');
$server = m::mock('League\OAuth2\Server\AbstractServer')->makePartial();
$repo = new FluentRefreshToken($this->app['db']);
$repo->setServer($server);

Expand All @@ -22,6 +22,8 @@ public function test_it_fetches_a_refresh_token_with_a_valid_token()

$this->assertInstanceOf('League\OAuth2\Server\Entity\RefreshTokenEntity', $result);
$this->assertEquals('totallyarefreshtoken1', $result->getId());
$this->assertInstanceOf('League\OAuth2\Server\Entity\AccessTokenEntity', $result->getAccessToken());
$this->assertEquals('totallyanaccesstoken1', $result->getAccessToken()->getId());
$this->assertInternalType('int', $result->getExpireTime());
}

Expand Down Expand Up @@ -56,6 +58,8 @@ public function test_it_creates_a_refresh_token()

$this->assertInstanceOf('League\OAuth2\Server\Entity\RefreshTokenEntity', $result);
$this->assertEquals('newrefreshtoken', $result->getId());
$this->assertInstanceOf('League\OAuth2\Server\Entity\AccessTokenEntity', $result->getAccessToken());
$this->assertEquals('totallyanaccesstoken2', $result->getAccessToken()->getId());
$this->assertInternalType('int', $result->getExpireTime());
$this->assertEquals($time, $result->getExpireTime());
}
Expand Down

0 comments on commit 6493aca

Please sign in to comment.