protected function EntityReferenceIntegrationTest::getTestEntities in Drupal 10
Same name and namespace in other branches
- 8 core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php \Drupal\Tests\field\Functional\EntityReference\EntityReferenceIntegrationTest::getTestEntities()
- 9 core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php \Drupal\Tests\field\Functional\EntityReference\EntityReferenceIntegrationTest::getTestEntities()
Creates two content and two config test entities.
Return value
array An array of entity objects.
1 call to EntityReferenceIntegrationTest::getTestEntities()
- EntityReferenceIntegrationTest::testSupportedEntityTypesAndWidgets in core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceIntegrationTest.php - Tests the entity reference field with all its supported field widgets.
File
- core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceIntegrationTest.php, line 223
Class
- EntityReferenceIntegrationTest
- Tests various Entity reference UI components.
Namespace
Drupal\Tests\field\Functional\EntityReferenceCode
protected function getTestEntities() {
$storage = \Drupal::entityTypeManager()
->getStorage('config_test');
$config_entity_1 = $storage
->create([
'id' => $this
->randomMachineName(),
'label' => $this
->randomMachineName(),
]);
$config_entity_1
->save();
$config_entity_2 = $storage
->create([
'id' => $this
->randomMachineName(),
'label' => $this
->randomMachineName(),
]);
$config_entity_2
->save();
$content_entity_1 = EntityTest::create([
'name' => $this
->randomMachineName(),
]);
$content_entity_1
->save();
$content_entity_2 = EntityTest::create([
'name' => $this
->randomMachineName(),
]);
$content_entity_2
->save();
return [
'config' => [
$config_entity_1,
$config_entity_2,
],
'content' => [
$content_entity_1,
$content_entity_2,
],
];
}