You are here

protected function EntityControllerCacheUtilsTrait::saveAllEntitiesAndValidate in Apigee Edge 8

Saves entities into the entity cache and checks the result.

Parameters

\Apigee\Edge\Entity\EntityInterface[] $entities: Apigee Edge entities to save into the cache.

\Drupal\apigee_edge\Entity\Controller\Cache\EntityCacheInterface $entity_cache: The entity cache implementation.

\Drupal\apigee_edge\Entity\Controller\Cache\EntityIdCacheInterface $entity_id_cache: The entity id cache implementation.

3 calls to EntityControllerCacheUtilsTrait::saveAllEntitiesAndValidate()
EntityControllerCacheTest::testAppEntityControllerCache in tests/src/Kernel/EntityControllerCacheTest.php
Tests app entity controller cache.
EntityControllerCacheTest::testDeveloperEntityControllerCache in tests/src/Kernel/EntityControllerCacheTest.php
Tests developer entity controller cache.
EntityControllerCacheTest::testTeamEntityControllerCache in modules/apigee_edge_teams/tests/src/Kernel/EntityControllerCacheTest.php
Tests team entity controller cache.

File

tests/src/Traits/EntityControllerCacheUtilsTrait.php, line 40

Class

EntityControllerCacheUtilsTrait
A trait to common functions of entity controller tests.

Namespace

Drupal\Tests\apigee_edge\Traits

Code

protected function saveAllEntitiesAndValidate(array $entities, EntityCacheInterface $entity_cache, EntityIdCacheInterface $entity_id_cache) {

  // Save the generated entities into the controller cache.
  $entity_cache
    ->saveEntities($entities);
  $this
    ->assertSame($entities, $entity_cache
    ->getEntities());

  // Set cache states to TRUE.
  $entity_cache
    ->allEntitiesInCache(TRUE);
  $this
    ->assertTrue($entity_cache
    ->isAllEntitiesInCache());
  $this
    ->assertTrue($entity_id_cache
    ->isAllIdsInCache());
}