You are here

protected function EntityResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability()
  2. 10 core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::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.

1 call to EntityResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability()
EntityResourceTestBase::testGet in core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
Test a GET request for an entity, plus edge cases to ensure good DX.
7 methods override EntityResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability()
BlockContentResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability in core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php
The cacheability of unauthorized 'view' entity access.
BlockResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability in core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php
The cacheability of unauthorized 'view' entity access.
CommentResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability in core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
The cacheability of unauthorized 'view' entity access.
MediaResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability in core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php
The cacheability of unauthorized 'view' entity access.
SearchPageResourceTestBase::getExpectedUnauthorizedEntityAccessCacheability in core/modules/search/tests/src/Functional/Rest/SearchPageResourceTestBase.php
The cacheability of unauthorized 'view' entity access.

... See full list

File

core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php, line 392

Class

EntityResourceTestBase
Even though there is the generic EntityResource, it's necessary for every entity type to have its own test, because they each have different fields, validation constraints, et cetera. It's not because the generic case works, that every case…

Namespace

Drupal\Tests\rest\Functional\EntityResource

Code

protected function getExpectedUnauthorizedEntityAccessCacheability($is_authenticated) {
  return new CacheableMetadata();
}