function EntityViewBuilderTest::createTestEntity
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php \Drupal\KernelTests\Core\Entity\EntityViewBuilderTest::createTestEntity()
- 8.9.x core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php \Drupal\KernelTests\Core\Entity\EntityViewBuilderTest::createTestEntity()
- 10 core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php \Drupal\KernelTests\Core\Entity\EntityViewBuilderTest::createTestEntity()
Creates an entity for testing.
Parameters
string $entity_type: The entity type.
Return value
\Drupal\Core\Entity\EntityInterface The created entity.
8 calls to EntityViewBuilderTest::createTestEntity()
- EntityViewBuilderTest::testEntityViewBuilderCache in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityViewBuilderTest.php - Tests entity render cache handling.
- EntityViewBuilderTest::testEntityViewBuilderCacheToggling in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityViewBuilderTest.php - Tests entity render cache toggling.
- EntityViewBuilderTest::testEntityViewBuilderCacheWithReferences in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityViewBuilderTest.php - Tests entity render cache with references.
- EntityViewBuilderTest::testEntityViewBuilderWeight in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityViewBuilderTest.php - Tests weighting of display components.
- EntityViewBuilderTest::testExternalEntity in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityViewBuilderTest.php - Tests an entity type with an external canonical rel.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityViewBuilderTest.php, line 352
Class
- EntityViewBuilderTest
- Tests the entity view builder.
Namespace
Drupal\KernelTests\Core\EntityCode
protected function createTestEntity($entity_type) : EntityInterface {
$data = [
'bundle' => $entity_type,
'name' => $this->randomMachineName(),
];
return $this->container
->get('entity_type.manager')
->getStorage($entity_type)
->create($data);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.