You are here

protected function EntityUnitTestBase::reloadEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Entity/EntityUnitTestBase.php \Drupal\system\Tests\Entity\EntityUnitTestBase::reloadEntity()

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.

5 calls to EntityUnitTestBase::reloadEntity()
EntityRevisionTranslationTest::testRevertRevisionAfterTranslation in core/modules/system/src/Tests/Entity/EntityRevisionTranslationTest.php
Tests if the translation object has the right revision id after new revision.
EntityTranslationTest::doTestEntityTranslationAPI in core/modules/system/src/Tests/Entity/EntityTranslationTest.php
Executes the Entity Translation API tests for the given entity type.
EntityTranslationTest::doTestLanguageFallback in core/modules/system/src/Tests/Entity/EntityTranslationTest.php
Executes the language fallback test for the given entity type.
FieldItemTest::assertSavedFieldItemValue in core/modules/system/src/Tests/Field/FieldItemTest.php
Checks that the saved field item value matches the expected one.
FieldTranslationSqlStorageTest::testFieldSqlStorage in core/modules/system/src/Tests/Entity/FieldTranslationSqlStorageTest.php
Tests field SQL storage.

File

core/modules/system/src/Tests/Entity/EntityUnitTestBase.php, line 129
Contains \Drupal\system\Tests\Entity\EntityUnitTestBase.

Class

EntityUnitTestBase
Defines an abstract test base for entity unit tests.

Namespace

Drupal\system\Tests\Entity

Code

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