function FileResourceTestBase::grantPermissionsToTestedRole

Grants permissions to the tested role: anonymous or authenticated.

Parameters

string[] $permissions: Permissions to grant.

Overrides ResourceTestBase::grantPermissionsToTestedRole

1 call to FileResourceTestBase::grantPermissionsToTestedRole()
FileResourceTestBase::setUpAuthorization in core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php
Sets up the necessary authorization.

File

core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php, line 68

Class

FileResourceTestBase

Namespace

Drupal\Tests\file\Functional\Rest

Code

protected function grantPermissionsToTestedRole(array $permissions) {
  // testPatch() and testDelete() test the 'bc_entity_resource_permissions' BC
  // layer; also call makeCurrentUserFileOwner() then.
  if ($permissions === [
    'restful patch entity:file',
  ] || $permissions === [
    'restful delete entity:file',
  ]) {
    $this->makeCurrentUserFileOwner();
  }
  parent::grantPermissionsToTestedRole($permissions);
}

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