protected static function CommentTest::getExpectedCollectionCacheability in JSON:API 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/CommentTest.php \Drupal\Tests\jsonapi\Functional\CommentTest::getExpectedCollectionCacheability()
Computes the cacheability for a given entity collection.
Parameters
\Drupal\Core\Entity\EntityInterface[] $collection: The entities for which cacheability should be computed.
array $sparse_fieldset: (optional) If a sparse fieldset is being requested, limit the expected cacheability for the collection entities' fields to just those in the fieldset. NULL means all fields.
\Drupal\Core\Session\AccountInterface $account: An account for which cacheability should be computed (cacheability is dependent on access).
bool $filtered: Whether the collection is filtered or not.
Return value
\Drupal\Core\Cache\CacheableMetadata The expected cacheability for the given entity collection.
Overrides ResourceTestBase::getExpectedCollectionCacheability
File
- tests/
src/ Functional/ CommentTest.php, line 468
Class
- CommentTest
- JSON API integration test for the "Comment" content entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected static function getExpectedCollectionCacheability(array $collection, array $sparse_fieldset = NULL, AccountInterface $account, $filtered = FALSE) {
$cacheability = parent::getExpectedCollectionCacheability($collection, $sparse_fieldset, $account, $filtered);
if ($filtered) {
$cacheability
->addCacheTags([
'state:jsonapi__entity_test_filter_access_blacklist',
]);
}
return $cacheability;
}