function CommentTest::getExpectedUnauthorizedAccessMessage

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/CommentTest.php \Drupal\Tests\jsonapi\Functional\CommentTest::getExpectedUnauthorizedAccessMessage()
  2. 8.9.x core/modules/jsonapi/tests/src/Functional/CommentTest.php \Drupal\Tests\jsonapi\Functional\CommentTest::getExpectedUnauthorizedAccessMessage()
  3. 10 core/modules/jsonapi/tests/src/Functional/CommentTest.php \Drupal\Tests\jsonapi\Functional\CommentTest::getExpectedUnauthorizedAccessMessage()

Overrides ResourceTestBase::getExpectedUnauthorizedAccessMessage

File

core/modules/jsonapi/tests/src/Functional/CommentTest.php, line 294

Class

CommentTest
JSON:API integration test for the "Comment" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function 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.";
        default:
            return parent::getExpectedUnauthorizedAccessMessage($method);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.