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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user