public function ConfigEntityStaticCacheTest::testReset in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php \Drupal\KernelTests\Core\Config\ConfigEntityStaticCacheTest::testReset()
- 10 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php \Drupal\KernelTests\Core\Config\ConfigEntityStaticCacheTest::testReset()
Tests that the static cache is reset on entity save and delete.
File
- core/tests/ Drupal/ KernelTests/ Core/ Config/ ConfigEntityStaticCacheTest.php, line 66 
Class
- ConfigEntityStaticCacheTest
- Tests the entity static cache when used by config entities.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testReset() {
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage($this->entityTypeId);
  $entity = $storage
    ->load($this->entityId);
  // Ensure loading after a save retrieves the updated entity rather than an
  // obsolete cached one.
  $entity->label = 'New label';
  $entity
    ->save();
  $entity = $storage
    ->load($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($storage
    ->load($this->entityId));
}