function BlockResourceTestBase::setUpAuthorization

Same name in other branches
  1. 9 core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php \Drupal\Tests\block\Functional\Rest\BlockResourceTestBase::setUpAuthorization()
  2. 10 core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php \Drupal\Tests\block\Functional\Rest\BlockResourceTestBase::setUpAuthorization()
  3. 11.x core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php \Drupal\Tests\block\Functional\Rest\BlockResourceTestBase::setUpAuthorization()

Overrides ResourceTestBase::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;
    }
}

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