protected function CommentResourceTestBase::getExpectedUnauthorizedAccessMessage in Drupal 8
Same name and namespace in other branches
- 9 core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentResourceTestBase::getExpectedUnauthorizedAccessMessage()
- 10 core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentResourceTestBase::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/ comment/ tests/ src/ Functional/ Rest/ CommentResourceTestBase.php, line 313
Class
Namespace
Drupal\Tests\comment\Functional\RestCode
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 comments' permission is required and the comment must be published.";
case 'POST':
return "The 'post comments' permission is required.";
case 'PATCH':
return "The 'edit own comments' permission is required, the user must be the comment author, and the comment must be published.";
case 'DELETE':
// \Drupal\comment\CommentAccessControlHandler::checkAccess() does not
// specify a reason for not allowing a comment to be deleted.
return '';
}
}