You are here

protected function MessageResourceTestBase::getExpectedUnauthorizedAccessMessage in Drupal 8

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

Class

MessageResourceTestBase

Namespace

Drupal\Tests\contact\Functional\Rest

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
  if ($this
    ->config('rest.settings')
    ->get('bc_entity_resource_permissions')) {
    return parent::getExpectedUnauthorizedAccessMessage($method);
  }
  if ($method === 'POST') {
    return "The 'access site-wide contact form' permission is required.";
  }
  return parent::getExpectedUnauthorizedAccessMessage($method);
}