protected function ViewTestBase::enableViewsTestModule in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/ViewTestBase.php \Drupal\views\Tests\ViewTestBase::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.
35 calls to ViewTestBase::enableViewsTestModule()
- AccessTest::setUp in core/
modules/ views/ src/ Tests/ Plugin/ AccessTest.php - Sets up a Drupal site for running functional and integration tests.
- AccessTestBase::setUp in core/
modules/ user/ src/ Tests/ Views/ AccessTestBase.php - Sets up a Drupal site for running functional and integration tests.
- AnalyzeTest::setUp in core/
modules/ views_ui/ src/ Tests/ AnalyzeTest.php - Sets up a Drupal site for running functional and integration tests.
- AreaTest::setUp in core/
modules/ views/ src/ Tests/ Handler/ AreaTest.php - Sets up a Drupal site for running functional and integration tests.
- AreaTitleWebTest::setUp in core/
modules/ views/ src/ Tests/ Handler/ AreaTitleWebTest.php - Sets up a Drupal site for running functional and integration tests.
File
- core/
modules/ views/ src/ Tests/ ViewTestBase.php, line 48 - Contains \Drupal\views\Tests\ViewTestBase.
Class
- ViewTestBase
- Defines a base class for Views testing in the full web test environment.
Namespace
Drupal\views\TestsCode
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(array(
'views_test_data',
));
$this
->resetAll();
$this
->rebuildContainer();
$this->container
->get('module_handler')
->reload();
// Load the test dataset.
$data_set = $this
->dataSet();
$query = db_insert('views_test_data')
->fields(array_keys($data_set[0]));
foreach ($data_set as $record) {
$query
->values($record);
}
$query
->execute();
}