You are here

protected function FarmEntityCacheTestTrait::assertEntityTestCache in farmOS 2.x

Assert that a cache value dependent on an entity's cache tags exists.

Parameters

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

bool $cache_hit: Boolean indicating if the cache lookup should result in a cache hit.

4 calls to FarmEntityCacheTestTrait::assertEntityTestCache()
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 37

Class

FarmEntityCacheTestTrait
Trait for testing invalidation of entity cache tags.

Namespace

Drupal\Tests\farm_test\Kernel

Code

protected function assertEntityTestCache(EntityInterface $entity, bool $cache_hit) {
  $cache_result = \Drupal::cache()
    ->get($this
    ->getEntityCacheId($entity));
  $this
    ->assertEquals($cache_hit, (bool) $cache_result);
}