You are here

protected function ResourceTestBase::getExpectedUnauthorizedAccessMessage in Drupal 9

Same name in this branch
  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()
Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessMessage()

Return the expected error message.

Parameters

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

Return value

string The error string.

8 calls to ResourceTestBase::getExpectedUnauthorizedAccessMessage()
CommentTest::getExpectedUnauthorizedAccessMessage in core/modules/jsonapi/tests/src/Functional/CommentTest.php
Return the expected error message.
FileTest::getExpectedUnauthorizedAccessMessage in core/modules/jsonapi/tests/src/Functional/FileTest.php
Return the expected error message.
MenuLinkContentTest::getExpectedUnauthorizedAccessMessage in core/modules/jsonapi/tests/src/Functional/MenuLinkContentTest.php
Return the expected error message.
ResourceTestBase::testDeleteIndividual in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
Tests DELETEing an individual resource, plus edge cases to ensure good DX.
ResourceTestBase::testGetIndividual in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
Tests GETting an individual resource, plus edge cases to ensure good DX.

... See full list

28 methods override ResourceTestBase::getExpectedUnauthorizedAccessMessage()
BaseFieldOverrideTest::getExpectedUnauthorizedAccessMessage in core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
Return the expected error message.
BlockTest::getExpectedUnauthorizedAccessMessage in core/modules/jsonapi/tests/src/Functional/BlockTest.php
Return the expected error message.
CommentTest::getExpectedUnauthorizedAccessMessage in core/modules/jsonapi/tests/src/Functional/CommentTest.php
Return the expected error message.
ConfigTestTest::getExpectedUnauthorizedAccessMessage in core/modules/jsonapi/tests/src/Functional/ConfigTestTest.php
Return the expected error message.
ContactFormTest::getExpectedUnauthorizedAccessMessage in core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
Return the expected error message.

... See full list

File

core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php, line 640

Class

ResourceTestBase
Subclass this for every JSON:API resource type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
  $permission = $this->entity
    ->getEntityType()
    ->getAdminPermission();
  if ($permission !== FALSE) {
    return "The '{$permission}' permission is required.";
  }
  return NULL;
}