You are here

protected function NopremiumBrowserTestBase::reloadEntity in Node Option Premium 8

Reloads an entity.

Parameters

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

Return value

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

2 calls to NopremiumBrowserTestBase::reloadEntity()
NodeEditTest::testNodeFormWithOverridePremiumAnyContentTypePermission in tests/src/Functional/NodeEditTest.php
Tests with an editor that may set premium for any content type.
NodeEditTest::testNodeFormWithOverridePremiumArticlePermission in tests/src/Functional/NodeEditTest.php
Tests with an editor that may only set premium for articles.

File

tests/src/Functional/NopremiumBrowserTestBase.php, line 53

Class

NopremiumBrowserTestBase
Provides a base class for Node Option Premium functional tests.

Namespace

Drupal\Tests\nopremium\Functional

Code

protected function reloadEntity(EntityInterface $entity) {

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