function PreviewTest::enableViewsTestModule
Same name in other branches
- 8.9.x core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php \Drupal\Tests\views_ui\FunctionalJavascript\PreviewTest::enableViewsTestModule()
- 10 core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php \Drupal\Tests\views_ui\FunctionalJavascript\PreviewTest::enableViewsTestModule()
- 11.x core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php \Drupal\Tests\views_ui\FunctionalJavascript\PreviewTest::enableViewsTestModule()
Sets up the views_test_data.module.
Because the schema of views_test_data.module is dependent on the test using it, it cannot be enabled normally.
1 call to PreviewTest::enableViewsTestModule()
- PreviewTest::setUp in core/
modules/ views_ui/ tests/ src/ FunctionalJavascript/ PreviewTest.php
File
-
core/
modules/ views_ui/ tests/ src/ FunctionalJavascript/ PreviewTest.php, line 67
Class
- PreviewTest
- Tests the UI preview functionality.
Namespace
Drupal\Tests\views_ui\FunctionalJavascriptCode
protected function enableViewsTestModule() {
// Define the schema and views data variable before enabling the test module.
\Drupal::state()->set('views_test_data_schema', $this->schemaDefinition());
\Drupal::state()->set('views_test_data_views_data', $this->viewsData());
\Drupal::service('module_installer')->install([
'views_test_data',
]);
$this->resetAll();
$this->rebuildContainer();
$this->container
->get('module_handler')
->reload();
// Load the test dataset.
$data_set = $this->dataSet();
$query = Database::getConnection()->insert('views_test_data')
->fields(array_keys($data_set[0]));
foreach ($data_set as $record) {
$query->values($record);
}
$query->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.