You are here

protected function ResourceTestBase::getExpectedUnauthorizedAccessMessage in JSON:API 8

Same name and namespace in other branches
  1. 8.2 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.

16 calls to ResourceTestBase::getExpectedUnauthorizedAccessMessage()
BlockTest::getExpectedUnauthorizedAccessMessage in tests/src/Functional/BlockTest.php
Return the expected error message.
CommentTest::getExpectedUnauthorizedAccessMessage in tests/src/Functional/CommentTest.php
Return the expected error message.
ConfigTestTest::getExpectedUnauthorizedAccessMessage in tests/src/Functional/ConfigTestTest.php
Return the expected error message.
EntityTestTest::getExpectedUnauthorizedAccessMessage in tests/src/Functional/EntityTestTest.php
Return the expected error message.
FileTest::getExpectedUnauthorizedAccessMessage in tests/src/Functional/FileTest.php
Return the expected error message.

... See full list

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

... See full list

File

tests/src/Functional/ResourceTestBase.php, line 555

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;
}