function BlockContentResourceTestBase::setUpAuthorization

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

Overrides ResourceTestBase::setUpAuthorization

File

core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php, line 42

Class

BlockContentResourceTestBase
ResourceTestBase for BlockContent entity.

Namespace

Drupal\Tests\block_content\Functional\Rest

Code

protected function setUpAuthorization($method) {
    switch ($method) {
        case 'GET':
        case 'PATCH':
            $this->grantPermissionsToTestedRole([
                'access block library',
                'edit any basic block content',
            ]);
            break;
        case 'POST':
            $this->grantPermissionsToTestedRole([
                'access block library',
                'create basic block content',
            ]);
            break;
        case 'DELETE':
            $this->grantPermissionsToTestedRole([
                'delete any basic block content',
            ]);
            break;
        default:
            $this->grantPermissionsToTestedRole([
                'administer block content',
            ]);
            break;
    }
}

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