You are here

protected function CommerceBrowserTestTrait::reloadEntity in Commerce Core 8.2

Reloads the entity after clearing the static cache.

Parameters

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

Return value

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

24 calls to CommerceBrowserTestTrait::reloadEntity()
AddressBookTest::testFallback in modules/order/tests/src/FunctionalJavascript/AddressBookTest.php
Tests the fallback to the default profile UI.
CheckoutFlowTest::testCheckoutFlowDependencies in modules/checkout/tests/src/Functional/CheckoutFlowTest.php
Tests that removing a dependency doesn't remove the checkout flow.
CheckoutOrderTest::testCheckout in modules/checkout/tests/src/Functional/CheckoutOrderTest.php
Tests anonymous and authenticated checkout.
CustomerProfileTest::testMultipleAdministrator in modules/order/tests/src/FunctionalJavascript/CustomerProfileTest.php
Tests the address book in "multiple" mode, for administrators.
CustomerProfileTest::testSingleAdministrator in modules/order/tests/src/FunctionalJavascript/CustomerProfileTest.php
Tests the address book in "single" mode, for administrators.

... See full list

File

tests/src/Traits/CommerceBrowserTestTrait.php, line 50

Class

CommerceBrowserTestTrait
Provides a trait for Commerce functional tests.

Namespace

Drupal\Tests\commerce\Traits

Code

protected function reloadEntity(EntityInterface $entity) {

  /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage($entity
    ->getEntityTypeId());
  $storage
    ->resetCache([
    $entity
      ->id(),
  ]);
  return $storage
    ->load($entity
    ->id());
}