function TermResourceTestBase::getExpectedUnauthorizedAccessMessage

Same name in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/Rest/TermResourceTestBase.php \Drupal\Tests\taxonomy\Functional\Rest\TermResourceTestBase::getExpectedUnauthorizedAccessMessage()
  2. 10 core/modules/taxonomy/tests/src/Functional/Rest/TermResourceTestBase.php \Drupal\Tests\taxonomy\Functional\Rest\TermResourceTestBase::getExpectedUnauthorizedAccessMessage()
  3. 11.x core/modules/taxonomy/tests/src/Functional/Rest/TermResourceTestBase.php \Drupal\Tests\taxonomy\Functional\Rest\TermResourceTestBase::getExpectedUnauthorizedAccessMessage()

Overrides EntityResourceTestBase::getExpectedUnauthorizedAccessMessage

File

core/modules/taxonomy/tests/src/Functional/Rest/TermResourceTestBase.php, line 254

Class

TermResourceTestBase

Namespace

Drupal\Tests\taxonomy\Functional\Rest

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
    if ($this->config('rest.settings')
        ->get('bc_entity_resource_permissions')) {
        return parent::getExpectedUnauthorizedAccessMessage($method);
    }
    switch ($method) {
        case 'GET':
            return "The 'access content' permission is required and the taxonomy term must be published.";
        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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.