1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-10 18:54:08 +02:00

[ticket/12716] Add regression test

PHPBB3-12716
This commit is contained in:
Tristan Darricau
2014-06-19 20:11:49 +02:00
parent 7c51418420
commit 8595b2ae86
3 changed files with 47 additions and 0 deletions

View File

@@ -13,6 +13,8 @@
use OAuth\OAuth2\Token\StdOAuth2Token;
require_once dirname(__FILE__) . '/phpbb_not_a_token.php';
class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_case
{
protected $db;
@@ -73,6 +75,22 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
$this->assertEquals($token, $stored_token);
}
public function test_retrieveAccessToken_wrong_token()
{
$this->user->data['session_id'] = 9999;
try
{
$this->token_storage->retrieveAccessToken($this->service_name);
$this->fail('The token can not be deserialized and an exception should be thrown.');
}
catch (\OAuth\Common\Storage\Exception\TokenNotFoundException $e)
{
}
$row = $this->get_token_row_by_session_id(9999);
$this->assertFalse($row);
}
public function test_retrieveAccessToken_from_db()
{
$expected_token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES);