protected function EntityFormTest::loadEntityByName

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

1 call to EntityFormTest::loadEntityByName()
EntityFormTest::testFormCRUD in drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php
Tests basic form CRUD functionality.

File

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

Class

EntityFormTest
Tests the Entity Form Controller.

Namespace

Drupal\system\Tests\Entity

Code

protected function loadEntityByName($name) {
  $entity_type = 'entity_test';

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