You are here

public function OAuth2ServerStorageTestCase::testGetClientDetails in OAuth2 Server 7

File

tests/oauth2_server.test, line 966
OAuth2 tests.

Class

OAuth2ServerStorageTestCase
Test \Drupal\oauth2_server\Storage.

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->client_key);
  $this
    ->assertNotNull($details, 'Client details successfully returned.');
  $this
    ->assertTrue(array_key_exists('client_id', $details), 'The "client_id" value is present in the client details.');
  $this
    ->assertTrue(array_key_exists('client_secret', $details), 'The "client_secret" value is present in the client details.');
  $this
    ->assertTrue(array_key_exists('redirect_uri', $details), 'The "redirect_uri" value is present in the client details.');
}