You are here

public function ConfigEntityStaticCacheTest::testCacheHit in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config/src/Tests/ConfigEntityStaticCacheTest.php \Drupal\config\Tests\ConfigEntityStaticCacheTest::testCacheHit()

Tests that the static cache is working.

File

core/modules/config/src/Tests/ConfigEntityStaticCacheTest.php, line 54
Contains \Drupal\config\Tests\ConfigEntityStaticCacheTest.

Class

ConfigEntityStaticCacheTest
Tests the entity static cache when used by config entities.

Namespace

Drupal\config\Tests

Code

public function testCacheHit() {
  $entity_1 = entity_load($this->entityTypeId, $this->entityId);
  $entity_2 = entity_load($this->entityTypeId, $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
    ->assertIdentical($entity_1->_loadStamp, $entity_2->_loadStamp);
}