function EntityReferenceIntegrationTest::getTestEntities
Same name in other branches
- 9 core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php \Drupal\Tests\field\Functional\EntityReference\EntityReferenceIntegrationTest::getTestEntities()
- 8.9.x core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php \Drupal\Tests\field\Functional\EntityReference\EntityReferenceIntegrationTest::getTestEntities()
- 10 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() : array {
$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,
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.