You are here

public function ConfigEntityStaticCacheTest::testReset 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::testReset()

Tests that the static cache is reset on entity save and delete.

File

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

Class

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

Namespace

Drupal\config\Tests

Code

public function testReset() {
  $entity = entity_load($this->entityTypeId, $this->entityId);

  // Ensure loading after a save retrieves the updated entity rather than an
  // obsolete cached one.
  $entity->label = 'New label';
  $entity
    ->save();
  $entity = entity_load($this->entityTypeId, $this->entityId);
  $this
    ->assertIdentical($entity->label, 'New label');

  // Ensure loading after a delete retrieves NULL rather than an obsolete
  // cached one.
  $entity
    ->delete();
  $this
    ->assertNull(entity_load($this->entityTypeId, $this->entityId));
}