function ResourceTestBase::getExpectedUnauthorizedAccessMessage

Same name in this branch
  1. 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessMessage()
Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessMessage()
  2. 9 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::getExpectedUnauthorizedAccessMessage()
  3. 8.9.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessMessage()
  4. 8.9.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::getExpectedUnauthorizedAccessMessage()
  5. 11.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessMessage()
  6. 11.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::getExpectedUnauthorizedAccessMessage()

Return the expected error message.

Parameters

string $method: The HTTP method (GET, POST, PATCH, DELETE).

Return value

string The error string.

1 call to ResourceTestBase::getExpectedUnauthorizedAccessMessage()
DbLogResourceTest::getExpectedUnauthorizedAccessMessage in core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
Return the expected error message.
5 methods override ResourceTestBase::getExpectedUnauthorizedAccessMessage()
DbLogResourceTest::getExpectedUnauthorizedAccessMessage in core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
Return the expected error message.
EntityResourceTestBase::getExpectedUnauthorizedAccessMessage in core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
Return the expected error message.
FileUploadResourceTestBase::getExpectedUnauthorizedAccessMessage in core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
Return the expected error message.
RestJsonApiUnsupported::getExpectedUnauthorizedAccessMessage in core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
Return the expected error message.
UserRegistrationRestTest::getExpectedUnauthorizedAccessMessage in core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
Return the expected error message.

File

core/modules/rest/tests/src/Functional/ResourceTestBase.php, line 189

Class

ResourceTestBase
Subclass this for every REST resource, every format and every auth provider.

Namespace

Drupal\Tests\rest\Functional

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
    $resource_plugin_id = str_replace('.', ':', static::$resourceConfigId);
    $permission = 'restful ' . strtolower($method) . ' ' . $resource_plugin_id;
    return "The '{$permission}' permission is required.";
}

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