function BlockResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability

Same name and namespace in other branches
  1. 8.9.x core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php \Drupal\Tests\block\Functional\Rest\BlockResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability()
  2. 10 core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php \Drupal\Tests\block\Functional\Rest\BlockResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability()
  3. 11.x core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php \Drupal\Tests\block\Functional\Rest\BlockResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability()

The cacheability of unauthorized 'view' entity access.

Parameters

bool $is_authenticated: Whether the current request is authenticated or not. This matters for some entity access control handlers, but not for most.

Return value

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

Overrides EntityResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability

File

core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php, line 159

Class

BlockResourceTestBase

Namespace

Drupal\Tests\block\Functional\Rest

Code

protected function getExpectedUnauthorizedEntityAccessCacheability($is_authenticated) {
    // @see \Drupal\block\BlockAccessControlHandler::checkAccess()
    return parent::getExpectedUnauthorizedEntityAccessCacheability($is_authenticated)->addCacheTags([
        'config:block.block.llama',
        $is_authenticated ? 'user:2' : 'user:0',
    ]);
}

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