You are here

protected function KernelTestBase::reloadEntity in Forms Steps 8

Reloads the given entity from the storage and returns it.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to be reloaded.

Return value

\Drupal\Core\Entity\EntityInterface The reloaded entity.

File

tests/src/Kernel/KernelTestBase.php, line 116

Class

KernelTestBase
Defines an abstract test base for kernel tests.

Namespace

Drupal\Tests\forms_steps\Kernel

Code

protected function reloadEntity(EntityInterface $entity) {
  $controller = $this->entityManager
    ->getStorage($entity
    ->getEntityTypeId());
  $controller
    ->resetCache([
    $entity
      ->id(),
  ]);
  return $controller
    ->load($entity
    ->id());
}