You are here

protected function BlockResourceTestBase::setUpAuthorization in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php \Drupal\Tests\block\Functional\Rest\BlockResourceTestBase::setUpAuthorization()
  2. 9 core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php \Drupal\Tests\block\Functional\Rest\BlockResourceTestBase::setUpAuthorization()

File

core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php, line 29

Class

BlockResourceTestBase

Namespace

Drupal\Tests\block\Functional\Rest

Code

protected function setUpAuthorization($method) {
  switch ($method) {
    case 'GET':
      $this->entity
        ->setVisibilityConfig('user_role', [])
        ->save();
      break;
    case 'POST':
      $this
        ->grantPermissionsToTestedRole([
        'administer blocks',
      ]);
      break;
    case 'PATCH':
      $this
        ->grantPermissionsToTestedRole([
        'administer blocks',
      ]);
      break;
  }
}