function ResourceTestBase::grantPermissionsToAnonymousRole

Same name in other branches
  1. 9 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::grantPermissionsToAnonymousRole()
  2. 8.9.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::grantPermissionsToAnonymousRole()
  3. 11.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::grantPermissionsToAnonymousRole()

Grants permissions to the anonymous role.

Parameters

string[] $permissions: Permissions to grant.

2 calls to ResourceTestBase::grantPermissionsToAnonymousRole()
ResourceTestBase::grantPermissionsToTestedRole in core/modules/rest/tests/src/Functional/ResourceTestBase.php
Grants permissions to the tested role: anonymous or authenticated.
UserRegistrationRestTest::setUpAuthorization in core/modules/user/tests/src/Functional/UserRegistrationRestTest.php

File

core/modules/rest/tests/src/Functional/ResourceTestBase.php, line 294

Class

ResourceTestBase
Subclass this for every REST resource, every format and every auth provider.

Namespace

Drupal\Tests\rest\Functional

Code

protected function grantPermissionsToAnonymousRole(array $permissions) {
    $this->grantPermissions(Role::load(RoleInterface::ANONYMOUS_ID), $permissions);
}

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