protected function EntityKernelTestBase::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php \Drupal\KernelTests\Core\Entity\EntityKernelTestBase::setUp()
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php \Drupal\KernelTests\Core\Entity\EntityKernelTestBase::setUp()
4 methods override EntityKernelTestBase::setUp()
- EntityDefinitionUpdateTest::setUp in core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
- EntityReferenceFormatterTest::setUp in core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
- FieldableEntityDefinitionUpdateTest::setUp in core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php
- TokenReplaceKernelTestBase::setUp in core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTestBase.php
File
- core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php, line 58
Class
- EntityKernelTestBase
- Defines an abstract test base for entity kernel tests.
Namespace
Drupal\KernelTests\Core\Entity
Code
protected function setUp() : void {
parent::setUp();
$this->entityTypeManager = $this->container
->get('entity_type.manager');
$this->state = $this->container
->get('state');
$this
->installSchema('system', 'sequences');
$this
->installEntitySchema('user');
$this
->installEntitySchema('entity_test');
$class = static::class;
while ($class) {
if (property_exists($class, 'modules')) {
$rp = new \ReflectionProperty($class, 'modules');
if ($rp->class == $class) {
foreach (array_intersect([
'node',
'comment',
], $class::$modules) as $module) {
$this
->installEntitySchema($module);
}
if (in_array('forum', $class::$modules, TRUE)) {
$this
->installEntitySchema('taxonomy_term');
$this
->installConfig([
'comment',
'node',
'taxonomy',
]);
$this
->installConfig([
'forum',
]);
}
}
}
$class = get_parent_class($class);
}
$this
->installConfig([
'field',
]);
}