function WorkspaceTest::setUpAuthorization

Same name in other branches
  1. 10 core/modules/jsonapi/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\jsonapi\Functional\WorkspaceTest::setUpAuthorization()

Overrides ResourceTestBase::setUpAuthorization

File

core/modules/jsonapi/tests/src/Functional/WorkspaceTest.php, line 77

Class

WorkspaceTest
JSON:API integration test for the "Workspace" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function setUpAuthorization($method) : void {
    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.