You are here

protected function FileResourceTestBase::grantPermissionsToTestedRole in Drupal 8

Grants permissions to the tested role: anonymous or authenticated.

Parameters

string[] $permissions: Permissions to grant.

Overrides ResourceTestBase::grantPermissionsToTestedRole

See also

::grantPermissionsToAuthenticatedRole()

::grantPermissionsToAnonymousRole()

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