You are here

protected function ShortcutSetResourceTestBase::getExpectedUnauthorizedAccessMessage in Drupal 8

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

Class

ShortcutSetResourceTestBase
ResourceTestBase for ShortcutSet 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':
      return "The 'access shortcuts' permission is required.";
    default:
      return parent::getExpectedUnauthorizedAccessMessage($method);
  }
}