function 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()
- 11.x core/modules/views/tests/src/Functional/Entity/FieldEntityTest.php \Drupal\Tests\views\Functional\Entity\FieldEntityTest::setUp()
- 11.x core/modules/views/tests/src/Kernel/Entity/FieldEntityTest.php \Drupal\Tests\views\Kernel\Entity\FieldEntityTest::setUp()
Sets up the test.
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.
array $modules: The module directories to look in for test views.
Overrides ViewTestBase::setUp
File
-
core/
modules/ views/ tests/ src/ Functional/ Entity/ FieldEntityTest.php, line 53
Class
- FieldEntityTest
- Tests the field plugin base integration with the entity system.
Namespace
Drupal\Tests\views\Functional\EntityCode
protected function setUp($import_test_views = TRUE, $modules = [
'views_test_config',
]) : void {
parent::setUp(FALSE, $modules);
$this->drupalCreateContentType([
'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.