function BlockContentResourceTestBase::getExpectedUnauthorizedAccessMessage

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

Overrides EntityResourceTestBase::getExpectedUnauthorizedAccessMessage

File

core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php, line 198

Class

BlockContentResourceTestBase
ResourceTestBase for BlockContent entity.

Namespace

Drupal\Tests\block_content\Functional\Rest

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
    if (!$this->resourceConfigStorage
        ->load(static::$resourceConfigId)) {
        return match ($method) {    'GET', 'PATCH' => "The 'edit any basic block content' permission is required.",
            'POST' => "The following permissions are required: 'create basic block content' AND 'access block library'.",
            'DELETE' => "The 'delete any basic block content' permission is required.",
            default => parent::getExpectedUnauthorizedAccessMessage($method),
        
        };
    }
    return match ($method) {    'GET' => "The 'access block library' permission is required.",
        'PATCH' => "The 'edit any basic block content' permission is required.",
        'POST' => "The following permissions are required: 'create basic block content' AND 'access block library'.",
        'DELETE' => "The 'delete any basic block content' permission is required.",
        default => parent::getExpectedUnauthorizedAccessMessage($method),
    
    };
}

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