You are here

protected function BlockTest::getExpectedUnauthorizedAccessCacheability in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/BlockTest.php \Drupal\Tests\jsonapi\Functional\BlockTest::getExpectedUnauthorizedAccessCacheability()
  2. 10 core/modules/jsonapi/tests/src/Functional/BlockTest.php \Drupal\Tests\jsonapi\Functional\BlockTest::getExpectedUnauthorizedAccessCacheability()

Returns the expected cacheability for an unauthorized response.

Return value

\Drupal\Core\Cache\CacheableMetadata The expected cacheability.

Overrides ResourceTestBase::getExpectedUnauthorizedAccessCacheability

File

core/modules/jsonapi/tests/src/Functional/BlockTest.php, line 174

Class

BlockTest
JSON:API integration test for the "Block" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedUnauthorizedAccessCacheability() {

  // @see \Drupal\block\BlockAccessControlHandler::checkAccess()
  return parent::getExpectedUnauthorizedAccessCacheability()
    ->setCacheTags([
    '4xx-response',
    'config:block.block.llama',
    'http_response',
    'user:2',
  ])
    ->setCacheContexts([
    'url.site',
    'user.roles',
  ]);
}