You are here

protected function TermTest::getExpectedUnauthorizedAccessMessage in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/TermTest.php \Drupal\Tests\jsonapi\Functional\TermTest::getExpectedUnauthorizedAccessMessage()

Return the expected error message.

Parameters

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

Return value

string The error string.

Overrides ResourceTestBase::getExpectedUnauthorizedAccessMessage

File

tests/src/Functional/TermTest.php, line 361

Class

TermTest
JSON API integration test for the "Term" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
  switch ($method) {
    case 'GET':
      return floatval(\Drupal::VERSION) >= 8.6 ? "The 'access content' permission is required and the taxonomy term must be published." : "The 'access content' permission is required.";
    case 'POST':
      return "The following permissions are required: 'create terms in camelids' OR 'administer taxonomy'.";
    case 'PATCH':
      return "The following permissions are required: 'edit terms in camelids' OR 'administer taxonomy'.";
    case 'DELETE':
      return "The following permissions are required: 'delete terms in camelids' OR 'administer taxonomy'.";
    default:
      return parent::getExpectedUnauthorizedAccessMessage($method);
  }
}