You are here

protected function NodeResourceTestBase::getExpectedUnauthorizedAccessMessage in Drupal 8

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

Class

NodeResourceTestBase

Namespace

Drupal\Tests\node\Functional\Rest

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
  if ($this
    ->config('rest.settings')
    ->get('bc_entity_resource_permissions')) {
    return parent::getExpectedUnauthorizedAccessMessage($method);
  }
  if ($method === 'GET' || $method == 'PATCH' || $method == 'DELETE' || $method == 'POST') {
    return "The 'access content' permission is required.";
  }
  return parent::getExpectedUnauthorizedAccessMessage($method);
}