You are here

protected function ResourceTestBase::revokePermissionsFromTestedRole in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::revokePermissionsFromTestedRole()

Revokes permissions from the authenticated role.

Parameters

string[] $permissions: Permissions to revoke.

2 calls to ResourceTestBase::revokePermissionsFromTestedRole()
CommentTest::testCollectionFilterAccess in tests/src/Functional/CommentTest.php
NodeTest::testCollectionFilterAccess in tests/src/Functional/NodeTest.php

File

tests/src/Functional/ResourceTestBase.php, line 580

Class

ResourceTestBase
Subclass this for every JSON API resource type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function revokePermissionsFromTestedRole(array $permissions) {
  $role = Role::load(RoleInterface::AUTHENTICATED_ID);
  foreach ($permissions as $permission) {
    $role
      ->revokePermission($permission);
  }
  $role
    ->trustData()
    ->save();
}