You are here

public function ClientGrantsTest::testGet in Auth0 Single Sign On 8.2

Test that get methods work as expected.

Return value

void

Throws

CoreException Thrown when there is a problem with parameters passed to the method.

\Exception Thrown by the Guzzle HTTP client when there is a problem with the API call.

File

vendor/auth0/auth0-php/tests/API/Management/ClientGrantsTest.php, line 96

Class

ClientGrantsTest
Class ClientGrantsTest. Tests the Auth0\SDK\API\Management\ClientGrants class.

Namespace

Auth0\Tests\API

Code

public function testGet() {
  $all_results = self::$api
    ->getAll();
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertNotEmpty($all_results);
  $expected_client_id = $all_results[0]['client_id'] ?: null;
  $this
    ->assertNotNull($expected_client_id);
  $expected_audience = $all_results[0]['audience'] ?: null;
  $this
    ->assertNotNull($expected_audience);
  $audience_results = self::$api
    ->getByAudience($expected_audience);
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertNotEmpty($audience_results);
  $this
    ->assertEquals($expected_audience, $audience_results[0]['audience']);
  $client_id_results = self::$api
    ->getByClientId($expected_client_id);
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertNotEmpty($client_id_results);
  $this
    ->assertEquals($expected_client_id, $client_id_results[0]['client_id']);
}