protected function EntityFormTest::loadEntityByName

Loads a test entity by name always resetting the storage controller cache.

1 call to EntityFormTest::loadEntityByName()
EntityFormTest::assertFormCRUD in drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php
Executes the form CRUD tests for the given entity type.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php, line 97
Definition of Drupal\system\Tests\Entity\EntityFormTest.

Class

EntityFormTest
Tests the Entity Form Controller.

Namespace

Drupal\system\Tests\Entity

Code

protected function loadEntityByName($entity_type, $name) {

  // Always load the entity from the database to ensure that changes are
  // correctly picked up.
  $this->container
    ->get('plugin.manager.entity')
    ->getStorageController($entity_type)
    ->resetCache();
  return current(entity_load_multiple_by_properties($entity_type, array(
    'name' => $name,
  )));
}