You are here

protected function FileResourceTestBase::getExpectedUnauthorizedAccessMessage in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedUnauthorizedAccessMessage()
  2. 9 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedUnauthorizedAccessMessage()

Return the expected error message.

Parameters

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

Return value

string The error string.

Overrides EntityResourceTestBase::getExpectedUnauthorizedAccessMessage

File

core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php, line 210

Class

FileResourceTestBase

Namespace

Drupal\Tests\file\Functional\Rest

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
  if ($method === 'GET') {
    return "The 'access content' permission is required.";
  }
  if ($method === 'PATCH' || $method === 'DELETE') {
    return 'Only the file owner can update or delete the file entity.';
  }
  return parent::getExpectedUnauthorizedAccessMessage($method);
}