function ResourceTestBase::revokePermissionsFromTestedRole

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::revokePermissionsFromTestedRole()
  2. 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::revokePermissionsFromTestedRole()
  3. 11.x core/modules/jsonapi/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 core/modules/jsonapi/tests/src/Functional/CommentTest.php
NodeTest::testCollectionFilterAccess in core/modules/jsonapi/tests/src/Functional/NodeTest.php

File

core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php, line 663

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.