protected function FileResourceTestBase::getExpectedUnauthorizedAccessMessage in Drupal 8
Same name and namespace in other branches
- 9 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedUnauthorizedAccessMessage()
- 10 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 219
Class
Namespace
Drupal\Tests\file\Functional\RestCode
protected function getExpectedUnauthorizedAccessMessage($method) {
if ($this
->config('rest.settings')
->get('bc_entity_resource_permissions')) {
if ($method === 'DELETE') {
return 'Only the file owner can update or delete the file entity.';
}
return parent::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);
}