You are here

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

Test that getByAudience 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 229

Class

GrantsTestMocked
Class GrantsTestMocked.

Namespace

Auth0\Tests\API\Management

Code

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