You are here

private function OauthTokenFileStorageTest::tokenStorage in Apigee Edge 8

Returns a pre-configured token storage service for testing.

Parameters

bool $rebuild: Enforces rebuild of the container and with the the token storage service.

Return value

\Drupal\apigee_edge\OauthTokenFileStorage The configured and initialized OAuth file token storage service.

Throws

\Exception

6 calls to OauthTokenFileStorageTest::tokenStorage()
OauthTokenFileStorageTest::testCacheClear in tests/src/Kernel/OauthTokenFileStorageTest.php
Test that the tokens are removed when cache is cleared.
OauthTokenFileStorageTest::testCheckRequirements in tests/src/Kernel/OauthTokenFileStorageTest.php
Validates checks in the storage.
OauthTokenFileStorageTest::testGetters in tests/src/Kernel/OauthTokenFileStorageTest.php
Test the get and has methods of the cache storage.
OauthTokenFileStorageTest::testSaveToken in tests/src/Kernel/OauthTokenFileStorageTest.php
Test that saving a token produces the expected file data.
OauthTokenFileStorageTest::testStaticCaching in tests/src/Kernel/OauthTokenFileStorageTest.php
Test the token storage is using static cache.

... See full list

File

tests/src/Kernel/OauthTokenFileStorageTest.php, line 90

Class

OauthTokenFileStorageTest
OAuth cache storage tests.

Namespace

Drupal\Tests\apigee_edge\Kernel

Code

private function tokenStorage(bool $rebuild = FALSE) : OauthTokenFileStorage {
  $config = $this
    ->config('apigee_edge.auth');
  $config
    ->set('oauth_token_storage_location', $this
    ->tokenDirectoryUri())
    ->save();
  if ($rebuild) {
    $this->container
      ->get('kernel')
      ->rebuildContainer();
  }
  return $this->container
    ->get('apigee_edge.authentication.oauth_token_storage');
}