You are here

protected function ShortcutResourceTestBase::getExpectedUnauthorizedAccessMessage in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/shortcut/tests/src/Functional/Rest/ShortcutResourceTestBase.php \Drupal\Tests\shortcut\Functional\Rest\ShortcutResourceTestBase::getExpectedUnauthorizedAccessMessage()
  2. 10 core/modules/shortcut/tests/src/Functional/Rest/ShortcutResourceTestBase.php \Drupal\Tests\shortcut\Functional\Rest\ShortcutResourceTestBase::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/shortcut/tests/src/Functional/Rest/ShortcutResourceTestBase.php, line 151

Class

ShortcutResourceTestBase
ResourceTestBase for Shortcut entity.

Namespace

Drupal\Tests\shortcut\Functional\Rest

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
  if ($this
    ->config('rest.settings')
    ->get('bc_entity_resource_permissions')) {
    return parent::getExpectedUnauthorizedAccessMessage($method);
  }
  switch ($method) {
    case 'GET':
    case 'POST':
    case 'PATCH':
    case 'DELETE':
      return "The shortcut set must be the currently displayed set for the user and the user must have 'access shortcuts' AND 'customize shortcut links' permissions.";
    default:
      return parent::getExpectedUnauthorizedAccessMessage($method);
  }
}