function FieldEntityTest::setUp
Same name in this branch
- 11.x core/modules/views/tests/src/Functional/Entity/FieldEntityTest.php \Drupal\Tests\views\Functional\Entity\FieldEntityTest::setUp()
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Functional/Entity/FieldEntityTest.php \Drupal\Tests\views\Functional\Entity\FieldEntityTest::setUp()
- 8.9.x core/modules/views/tests/src/Functional/Entity/FieldEntityTest.php \Drupal\Tests\views\Functional\Entity\FieldEntityTest::setUp()
- 10 core/modules/views/tests/src/Functional/Entity/FieldEntityTest.php \Drupal\Tests\views\Functional\Entity\FieldEntityTest::setUp()
Parameters
bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.
Overrides ViewsKernelTestBase::setUp
File
-
core/
modules/ views/ tests/ src/ Kernel/ Entity/ FieldEntityTest.php, line 48
Class
- FieldEntityTest
- Tests the field plugin base integration with the entity system.
Namespace
Drupal\Tests\views\Kernel\EntityCode
protected function setUp($import_test_views = TRUE, $modules = [
'views_test_config',
]) : void {
parent::setUp(FALSE);
$this->installEntitySchema('node');
$this->installEntitySchema('comment');
$this->installEntitySchema('user');
$this->installSchema('node', [
'node_access',
]);
$this->installSchema('comment', [
'comment_entity_statistics',
]);
$this->installConfig([
'node',
'comment',
]);
$this->createContentType([
'type' => 'page',
]);
$this->addDefaultCommentField('node', 'page');
// Add an entity reference field for the test_field_get_entity_null view.
FieldStorageConfig::create([
'field_name' => 'field_test_reference',
'type' => 'entity_reference',
'entity_type' => 'node',
'cardinality' => 1,
'settings' => [
'target_type' => 'node',
],
])->save();
FieldConfig::create([
'field_name' => 'field_test_reference',
'entity_type' => 'node',
'bundle' => 'page',
'label' => 'field_test_reference',
'settings' => [
'handler' => 'default',
'handler_settings' => [
'target_bundles' => [
'page' => 'page',
],
],
],
])->save();
ViewTestData::createTestViews(static::class, $modules);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.