You are here

protected function WorkspaceResourceTestBase::getExpectedUnauthorizedAccessMessage in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php \Drupal\Tests\workspaces\Functional\EntityResource\WorkspaceResourceTestBase::getExpectedUnauthorizedAccessMessage()

Return the expected error message.

Parameters

string $method: The HTTP method (GET, POST, PATCH, DELETE).

Return value

string The error string.

Overrides EntityResourceTestBase::getExpectedUnauthorizedAccessMessage

File

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

Class

WorkspaceResourceTestBase
Base class for workspace EntityResource tests.

Namespace

Drupal\Tests\workspaces\Functional\EntityResource

Code

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