You are here

public function OAuth2ClientTestCase::errorCases in OAuth2 Client 7

Same name and namespace in other branches
  1. 7.2 tests/oauth2_client.test \OAuth2ClientTestCase::errorCases()

Test error cases.

1 call to OAuth2ClientTestCase::errorCases()
OAuth2ClientTestCase::testGetAccessToken in tests/oauth2_client.test

File

tests/oauth2_client.test, line 108
OAuth2 Client tests.

Class

OAuth2ClientTestCase
Test OAuth2 Client.

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
}