protected function EntityFormTest::loadEntityByName in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Entity/EntityFormTest.php \Drupal\Tests\system\Functional\Entity\EntityFormTest::loadEntityByName()
- 9 core/modules/system/tests/src/Functional/Entity/EntityFormTest.php \Drupal\Tests\system\Functional\Entity\EntityFormTest::loadEntityByName()
Loads a test entity by name always resetting the storage cache.
2 calls to EntityFormTest::loadEntityByName()
- EntityFormTest::doTestFormCRUD in core/
modules/ system/ tests/ src/ Functional/ Entity/ EntityFormTest.php - Executes the form CRUD tests for the given entity type.
- EntityFormTest::doTestMultilingualFormCRUD in core/
modules/ system/ tests/ src/ Functional/ Entity/ EntityFormTest.php - Executes the multilingual form CRUD tests for the given entity type ID.
File
- core/
modules/ system/ tests/ src/ Functional/ Entity/ EntityFormTest.php, line 190
Class
- EntityFormTest
- Tests the entity form.
Namespace
Drupal\Tests\system\Functional\EntityCode
protected function loadEntityByName($entity_type, $name) {
// Always load the entity from the database to ensure that changes are
// correctly picked up.
$entity_storage = $this->container
->get('entity_type.manager')
->getStorage($entity_type);
$entity_storage
->resetCache();
$entities = $entity_storage
->loadByProperties([
'name' => $name,
]);
return $entities ? current($entities) : NULL;
}