aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auth/provider_oauth_token_storage_test.php
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-06-19 20:11:49 +0200
committerTristan Darricau <github@nicofuma.fr>2014-06-19 21:04:43 +0200
commit8595b2ae86ca14c83d8a61241fadec9f72a730c3 (patch)
treedc6858e8dcc5356887d1a32e8f5596c4ac0c940d /tests/auth/provider_oauth_token_storage_test.php
parent7c5141842081e7f9031cb3063089d2d03a30a0fe (diff)
downloadforums-8595b2ae86ca14c83d8a61241fadec9f72a730c3.tar
forums-8595b2ae86ca14c83d8a61241fadec9f72a730c3.tar.gz
forums-8595b2ae86ca14c83d8a61241fadec9f72a730c3.tar.bz2
forums-8595b2ae86ca14c83d8a61241fadec9f72a730c3.tar.xz
forums-8595b2ae86ca14c83d8a61241fadec9f72a730c3.zip
[ticket/12716] Add regression test
PHPBB3-12716
Diffstat (limited to 'tests/auth/provider_oauth_token_storage_test.php')
-rw-r--r--tests/auth/provider_oauth_token_storage_test.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auth/provider_oauth_token_storage_test.php b/tests/auth/provider_oauth_token_storage_test.php
index ec28e546bd..8919345087 100644
--- a/tests/auth/provider_oauth_token_storage_test.php
+++ b/tests/auth/provider_oauth_token_storage_test.php
@@ -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);