You are here

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

Test that a delete request 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 346

Class

GrantsTestMocked
Class GrantsTestMocked.

Namespace

Auth0\Tests\API\Management

Code

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