You are here

protected function OAuth2ClientTestCase::getToken in OAuth2 Client 7.2

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

Get and return a token from the given test client.

3 calls to OAuth2ClientTestCase::getToken()
OAuth2ClientTestCase::clientCredentialsFlow in tests/oauth2_client.test
Test the client-credentials flow.
OAuth2ClientTestCase::serverSideFlow in tests/oauth2_client.test
Test the server-side flow.
OAuth2ClientTestCase::userPasswordFlow in tests/oauth2_client.test
Test the user-password flow.

File

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

Class

OAuth2ClientTestCase
Test OAuth2 Client.

Code

protected function getToken($client) {
  $result = $this
    ->drupalGet('oauth2/test/' . $client);
  $this
    ->assertPattern('/^access_token: /', $result);
  $token = str_replace('access_token: ', '', $result);
  $token = trim($token);
  $this
    ->assertNotEqual($token, '', 'Token is not empty.');
  return $token;
}