function WorkspaceTest::getExpectedUnauthorizedAccessMessage

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

Overrides ResourceTestBase::getExpectedUnauthorizedAccessMessage

File

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

Class

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

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedUnauthorizedAccessMessage($method) : string {
    switch ($method) {
        case 'GET':
            return "The 'view own workspace' permission is required.";
        case 'POST':
            return "The following permissions are required: 'administer workspaces' OR 'create workspace'.";
        case 'PATCH':
            return "The 'edit own workspace' permission is required.";
        case 'DELETE':
            return "The 'delete own workspace' permission is required.";
        default:
            return parent::getExpectedUnauthorizedAccessMessage($method);
    }
}

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