You are here

public function GrantsTestMocked::testThatGrantsGetByClientIdThrowsException in Auth0 Single Sign On 8.2

Test that getByClientId throws an exception with an empty parameter.

Return value

void

Throws

\Exception Unsuccessful HTTP call.

File

vendor/auth0/auth0-php/tests/API/Management/GrantsMockedTest.php, line 165

Class

GrantsTestMocked
Class GrantsTestMocked.

Namespace

Auth0\Tests\API\Management

Code

public function testThatGrantsGetByClientIdThrowsException() {
  $api = new Management('__test_api_token__', '__test_domain__');
  try {
    $caught_exception = false;
    $api
      ->grants()
      ->getByClientId('');
  } catch (CoreException $e) {
    $caught_exception = $this
      ->errorHasString($e, 'Empty or invalid "client_id" parameter');
  }
  $this
    ->assertTrue($caught_exception);
  try {
    $caught_exception = false;
    $api
      ->grants()
      ->getByClientId([
      '__not_empty__',
    ]);
  } catch (CoreException $e) {
    $caught_exception = $this
      ->errorHasString($e, 'Empty or invalid "client_id" parameter');
  }
  $this
    ->assertTrue($caught_exception);
}