You are here

protected function UserProtectBrowserTestBase::reloadEntity in User protect 8

Reloads an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to reload.

Return value

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

3 calls to UserProtectBrowserTestBase::reloadEntity()
UserProtectionPermissionsTest::testEditOwnMail in tests/src/Functional/UserProtectionPermissionsTest.php
Tests edit mail with permission "userprotect.mail.edit".
UserProtectionPermissionsTest::testEditOwnPass in tests/src/Functional/UserProtectionPermissionsTest.php
Tests edit password with permission "userprotect.pass.edit".
UserProtectionTest::testRolesProtection in tests/src/Functional/UserProtectionTest.php
Tests if the user's roles field has the expected protection.

File

tests/src/Functional/UserProtectBrowserTestBase.php, line 35

Class

UserProtectBrowserTestBase
Provides a base class for User Protect functional tests.

Namespace

Drupal\Tests\userprotect\Functional

Code

protected function reloadEntity(EntityInterface $entity) {

  /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
  $storage = \Drupal::entityTypeManager()
    ->getStorage($entity
    ->getEntityTypeId());
  $storage
    ->resetCache([
    $entity
      ->id(),
  ]);
  return $storage
    ->load($entity
    ->id());
}