function TestViewsTest::setUp
Same name in other branches
- 11.x core/modules/views/tests/src/Kernel/TestViewsTest.php \Drupal\Tests\views\Kernel\TestViewsTest::setUp()
Overrides KernelTestBase::setUp
File
-
core/
modules/ views/ tests/ src/ Kernel/ TestViewsTest.php, line 128
Class
- TestViewsTest
- Tests that test views provided by all modules match schema.
Namespace
Drupal\Tests\views\KernelCode
protected function setUp() : void {
parent::setUp();
// `field.storage.node.body` config entity is a config dependency. It is one
// of the default config of the Node module.
// @see core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_tokens.yml
$this->installConfig('node');
// `user.role.authenticated` is a config dependency. It is one of the
// default config of the User module.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_feed_icon.yml
$this->installConfig('user');
// `system.menu.tools` is a config dependency. It is one of the default
// config of the System module.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_row_render_cache_none.yml
$this->installConfig('system');
// `node.type.article` is a config dependency.
// @see core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_numeric.yml
NodeType::create([
'type' => 'article',
'name' => 'Article',
])->save();
// `node.type.page` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_node.yml
NodeType::create([
'type' => 'page',
'name' => 'Page',
])->save();
// `taxonomy.vocabulary.tags` is a config dependency.
// @see core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_exposed_grouped_filter.yml
Vocabulary::create([
'vid' => 'tags',
'name' => 'Tags',
])->save();
// `taxonomy.vocabulary.test_exposed_checkboxes` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_form_checkboxes.yml
Vocabulary::create([
'vid' => 'test_exposed_checkboxes',
'name' => 'Exposed checkboxes test',
])->save();
// `core.entity_view_mode.node.default` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_field_renderered_entity.yml
EntityViewMode::create([
'id' => 'node.default',
'label' => 'Default',
'targetEntityType' => 'node',
])->save();
// `field.storage.node.field_link` is a config dependency.
// @see core/modules/link/tests/modules/link_test_views/test_views/views.view.test_link_tokens.yml
// @see \Drupal\Tests\link\Functional\Views\LinkViewsTokensTest
FieldStorageConfig::create([
'field_name' => 'field_link',
'type' => 'link',
'entity_type' => 'node',
'cardinality' => 1,
])->save();
// `field.storage.node.field_test` is a config dependency.
// @see core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_field_delete.yml
// @see \Drupal\Tests\field_ui\Functional\FieldUIDeleteTest::testDeleteField()
FieldStorageConfig::create([
'field_name' => 'field_test',
'type' => 'integer',
'entity_type' => 'node',
])->save();
// `field.storage.entity_test.field_test` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_attachment_test.yml
// @see \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::setUp()
FieldStorageConfig::create([
'field_name' => 'field_test',
'entity_type' => 'entity_test',
'type' => 'integer',
])->save();
// `views.view.test_group_rows` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_rows.yml
// @see \Drupal\Tests\views\Functional\Handler\FieldGroupRowsWebTest::setUp()
FieldStorageConfig::create([
'field_name' => 'field_views_testing_group_rows',
'entity_type' => 'node',
'type' => 'text',
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
])->save();
ViewTestData::createTestViews(self::class, [
'views_test_data',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.