You are here

public function OAuth2ServerStorageTest::testGetClientDetails in OAuth2 Server 2.0.x

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

Get client credentials.

File

tests/src/Functional/OAuth2ServerStorageTest.php, line 136

Class

OAuth2ServerStorageTest
The OAuth2 Server admin test case.

Namespace

Drupal\Tests\oauth2_server\Functional

Code

public function testGetClientDetails() {

  // Nonexistent client_id.
  $details = $this->storage
    ->getClientDetails('fakeclient');
  $this
    ->assertFalse($details, 'Invalid client_id correctly detected.');

  // Valid client_id.
  $details = $this->storage
    ->getClientDetails($this->clientId);
  $this
    ->assertNotNull($details, 'Client details successfully returned.');
  $this
    ->assertArrayHasKey('client_id', $details, 'The "client_id" value is present in the client details.');
  $this
    ->assertArrayHasKey('client_secret', $details, 'The "client_secret" value is present in the client details.');
  $this
    ->assertArrayHasKey('redirect_uri', $details, 'The "redirect_uri" value is present in the client details.');
}