You are here

public function OAuth2ClientTest::errorCases in OAuth2 Client 8

Test error cases.

1 call to OAuth2ClientTest::errorCases()
OAuth2ClientTest::testGetAccessToken in tests/src/Functional/OAuth2ClientTest.php

File

tests/src/Functional/OAuth2ClientTest.php, line 125

Class

OAuth2ClientTest
Test OAuth2 Client.

Namespace

Drupal\Tests\oauth2_client\Functional

Code

public function errorCases() {
  $error_cases = array(
    'wrong-client-id',
    'wrong-client-secret',
    'wrong-token-endpoint',
    'wrong-username',
    'wrong-password',
    'wrong-scope',
  );
  foreach ($error_cases as $error_case) {
    $this
      ->drupalGet('oauth2/test/' . $error_case);
    $this
      ->assertText('Failed to get an access token');
  }

  // wrong-auth-flow
  $this
    ->drupalGet('oauth2/test/wrong-auth-flow');
  $this
    ->assertText('Unknown authorization flow');

  // wrong-authorization-endpoint
  // wrong-redirect-uri
}