function ViewEntityDependenciesTest::setUp
Same name in other branches
- 8.9.x core/modules/views/tests/src/Kernel/Entity/ViewEntityDependenciesTest.php \Drupal\Tests\views\Kernel\Entity\ViewEntityDependenciesTest::setUp()
- 10 core/modules/views/tests/src/Kernel/Entity/ViewEntityDependenciesTest.php \Drupal\Tests\views\Kernel\Entity\ViewEntityDependenciesTest::setUp()
- 11.x core/modules/views/tests/src/Kernel/Entity/ViewEntityDependenciesTest.php \Drupal\Tests\views\Kernel\Entity\ViewEntityDependenciesTest::setUp()
Overrides ViewsKernelTestBase::setUp
File
-
core/
modules/ views/ tests/ src/ Kernel/ Entity/ ViewEntityDependenciesTest.php, line 44
Class
- ViewEntityDependenciesTest
- Tests the calculation of dependencies for views.
Namespace
Drupal\Tests\views\Kernel\EntityCode
protected function setUp($import_test_views = TRUE) : void {
parent::setUp(FALSE);
// Install the necessary dependencies for node type creation to work.
$this->installEntitySchema('node');
$this->installConfig([
'field',
'node',
]);
$comment_type = CommentType::create([
'id' => 'comment',
'label' => 'Comment settings',
'description' => 'Comment settings',
'target_entity_type_id' => 'node',
]);
$comment_type->save();
$content_type = NodeType::create([
'type' => $this->randomMachineName(),
'name' => $this->randomString(),
]);
$content_type->save();
$field_storage = FieldStorageConfig::create([
'field_name' => mb_strtolower($this->randomMachineName()),
'entity_type' => 'node',
'type' => 'comment',
]);
$field_storage->save();
FieldConfig::create([
'field_storage' => $field_storage,
'bundle' => $content_type->id(),
'label' => $this->randomMachineName() . '_label',
'description' => $this->randomMachineName() . '_description',
'settings' => [
'comment_type' => $comment_type->id(),
],
])
->save();
FieldConfig::create([
'field_storage' => FieldStorageConfig::loadByName('node', 'body'),
'bundle' => $content_type->id(),
'label' => $this->randomMachineName() . '_body',
'settings' => [
'display_summary' => TRUE,
],
])
->save();
ViewTestData::createTestViews(static::class, [
'views_test_config',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.