function WorkspaceResourceTestBase::setUpAuthorization

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

Overrides ResourceTestBase::setUpAuthorization

File

core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php, line 47

Class

WorkspaceResourceTestBase
Base class for workspace EntityResource tests.

Namespace

Drupal\Tests\workspaces\Functional\EntityResource

Code

protected function setUpAuthorization($method) {
    switch ($method) {
        case 'GET':
            $this->grantPermissionsToTestedRole([
                'view any workspace',
            ]);
            break;
        case 'POST':
            $this->grantPermissionsToTestedRole([
                'create workspace',
            ]);
            break;
        case 'PATCH':
            $this->grantPermissionsToTestedRole([
                'edit any workspace',
            ]);
            break;
        case 'DELETE':
            $this->grantPermissionsToTestedRole([
                'delete any workspace',
            ]);
            break;
    }
}

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