You are here

protected function FarmEntityCacheTestTrait::populateEntityTestCache in farmOS 2.x

Populate a cache value that is dependent on an entity's cache tags.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to cache data for.

string $data: The data to cache. Defaults to a simple string.

4 calls to FarmEntityCacheTestTrait::populateEntityTestCache()
GroupTest::testAssetLocation in modules/asset/group/tests/src/Kernel/GroupTest.php
Test asset location with group membership.
GroupTest::testGroupMembership in modules/asset/group/tests/src/Kernel/GroupTest.php
Test asset group membership.
InventoryTest::testSimpleAssetInventory in modules/core/inventory/tests/src/Kernel/InventoryTest.php
Test simple asset inventory.
LocationTest::testAssetLocation in modules/core/location/tests/src/Kernel/LocationTest.php
Test asset location.

File

modules/core/test/tests/src/Kernel/FarmEntityCacheTestTrait.php, line 25

Class

FarmEntityCacheTestTrait
Trait for testing invalidation of entity cache tags.

Namespace

Drupal\Tests\farm_test\Kernel

Code

protected function populateEntityTestCache(EntityInterface $entity, string $data = 'data') {
  \Drupal::cache()
    ->set($this
    ->getEntityCacheId($entity), $data, Cache::PERMANENT, $entity
    ->getCacheTags());
}