You are here

public function OAuth2ServerTest::testPasswordGrantType in OAuth2 Server 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/OAuth2ServerTest.php \Drupal\Tests\oauth2_server\Functional\OAuth2ServerTest::testPasswordGrantType()

Tests the "User credentials" grant type.

File

tests/src/Functional/OAuth2ServerTest.php, line 301

Class

OAuth2ServerTest
The OAuth2 Server admin test case.

Namespace

Drupal\Tests\oauth2_server\Functional

Code

public function testPasswordGrantType() {
  $response = $this
    ->passwordGrantRequest();
  $this
    ->assertEqual($response
    ->getStatusCode(), 200, 'The token request completed successfully');
  $payload = json_decode($response
    ->getBody());
  $this
    ->assertTokenResponse($payload);
}