Sets up Drupal unit test environment.
Overrides DrupalUnitTestBase::setUp
DrupalUnitTestBase::$modules
protected function setUp() {
parent::setUp();
// Define the schema and views data variable before enabling the test module.
$GLOBALS['views_test_data_schema'] = $this
->schemaDefinition();
$GLOBALS['views_test_data_views_data'] = $this
->viewsData();
$this
->enableModules(array(
'views',
'views_test_config',
'views_test_data',
));
// 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();
ViewTestData::importTestViews(get_class($this));
}