You are here

public function AkamaiAuthenticationTest::testSetupEdgeRc in Akamai 8.3

Tests that we can authorise when specifying edgerc file.

@covers ::create @covers ::getAuth

File

tests/src/Unit/AkamaiAuthenticationTest.php, line 23

Class

AkamaiAuthenticationTest
@coversDefaultClass \Drupal\akamai\AkamaiAuthentication

Namespace

Drupal\Tests\akamai\Unit

Code

public function testSetupEdgeRc() {
  $config = $this
    ->getEdgeRcConfig();
  $auth = AkamaiAuthentication::create($this
    ->getConfigFactoryStub([
    'akamai.settings' => $config,
  ]), $this
    ->prophesize(MessengerInterface::class)
    ->reveal(), $this
    ->prophesize(KeyProviderInterface::class)
    ->reveal());
  $expected = [
    'client_token' => 'edgerc-test-client-token',
    'client_secret' => 'edgerc-test-client-secret',
    'access_token' => 'edgerc-test-access-token',
  ];
  $this
    ->assertEquals($expected, $auth
    ->getAuth());
  $this
    ->assertEquals(get_class($auth), 'Drupal\\akamai\\AkamaiAuthentication');
}