You are here

public function RolesTestMocked::testThatRemoveRolePermissionsRequestWithInvalidPermissionsThrowsException in Auth0 Single Sign On 8.2

Test that an invalid permissions array throws an exception when trying to delete permissions from a role.

Return value

void

Throws

\Exception Should not be thrown in this test.

File

vendor/auth0/auth0-php/tests/API/Management/RolesMockedTest.php, line 442

Class

RolesTestMocked
Class RolesTestMocked.

Namespace

Auth0\Tests\API\Management

Code

public function testThatRemoveRolePermissionsRequestWithInvalidPermissionsThrowsException() {
  $api = new MockManagementApi();
  try {
    $api
      ->call()
      ->roles()
      ->removePermissions('__test_role_id__', [
      [
        'permission_name' => uniqid(),
      ],
    ]);
    $caught_exception = false;
  } catch (InvalidPermissionsArrayException $e) {
    $caught_exception = true;
  }
  $this
    ->assertTrue($caught_exception);
  try {
    $api
      ->call()
      ->roles()
      ->removePermissions('__test_role_id__', [
      [
        'resource_server_identifier' => uniqid(),
      ],
    ]);
    $caught_exception = false;
  } catch (InvalidPermissionsArrayException $e) {
    $caught_exception = true;
  }
  $this
    ->assertTrue($caught_exception);
}