public function ConfigEntityStaticCacheTest::testCacheHit in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php \Drupal\KernelTests\Core\Config\ConfigEntityStaticCacheTest::testCacheHit()
- 10 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php \Drupal\KernelTests\Core\Config\ConfigEntityStaticCacheTest::testCacheHit()
Tests that the static cache is working.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Config/ ConfigEntityStaticCacheTest.php, line 55
Class
- ConfigEntityStaticCacheTest
- Tests the entity static cache when used by config entities.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testCacheHit() {
$storage = $this->container
->get('entity_type.manager')
->getStorage($this->entityTypeId);
$entity_1 = $storage
->load($this->entityId);
$entity_2 = $storage
->load($this->entityId);
// config_entity_static_cache_test_config_test_load() sets _loadStamp to a
// random string. If they match, it means $entity_2 was retrieved from the
// static cache rather than going through a separate load sequence.
$this
->assertSame($entity_1->_loadStamp, $entity_2->_loadStamp);
}