protected function CacheInvalidationOnGroupChangeTest::populateCache in Organic groups 8
Caches a listing of group content that belongs to the given group.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $group: The group for which to cache a group content listing.
bool $include_group_cache_tag: Whether or not the group content listing is tagged with the group's cache tags.
1 call to CacheInvalidationOnGroupChangeTest::populateCache()
- CacheInvalidationOnGroupChangeTest::testCacheInvalidationOnGroupChange in tests/
src/ Kernel/ Entity/ CacheInvalidationOnGroupChangeTest.php - Tests if the cache is correctly invalidated on group change.
File
- tests/
src/ Kernel/ Entity/ CacheInvalidationOnGroupChangeTest.php, line 143
Class
- CacheInvalidationOnGroupChangeTest
- Tests if group content listings are invalidated when group audience changes.
Namespace
Drupal\Tests\og\Kernel\EntityCode
protected function populateCache(ContentEntityInterface $group, bool $include_group_cache_tag = FALSE) : void {
$cid = $this
->generateCid($group);
$tags = Cache::buildTags('og-group-content', $group
->getCacheTagsToInvalidate());
if ($include_group_cache_tag) {
$tags = Cache::mergeTags($tags, $group
->getCacheTagsToInvalidate());
}
$this->cache
->set($cid, $this
->randomString(), Cache::PERMANENT, $tags);
}