5 * Provides configuration entity static cache test helpers.
8 use Drupal\Component\Utility\Random;
11 * Implements hook_ENTITY_TYPE_load() for 'static_cache_test_config_test'.
13 function config_entity_static_cache_test_config_test_load($entities) {
16 $random = new Random();
18 foreach ($entities as $entity) {
19 // Add a random stamp for every load(), so that during tests, we can tell
20 // if an entity was retrieved from cache (unchanged stamp) or reloaded.
21 $entity->_loadStamp = $random->string(8, TRUE);
26 * Implements hook_entity_type_alter().
28 function config_entity_static_cache_test_entity_type_alter(array &$entity_types) {
29 /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
30 $entity_types['config_test']->set('static_cache', TRUE);