You are here

protected function ViewTestBase::enableViewsTestModule in Views (for Drupal 7) 8.3

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.

41 calls to ViewTestBase::enableViewsTestModule()
AccessTest::setUp in lib/Drupal/views/Tests/Plugin/AccessTest.php
Sets up a Drupal site for running functional and integration tests.
AccessTestBase::setUp in lib/Drupal/views/Tests/User/AccessTestBase.php
Sets up a Drupal site for running functional and integration tests.
AreaTest::setUp in lib/Drupal/views/Tests/Handler/AreaTest.php
Sets up a Drupal site for running functional and integration tests.
AreaTextTest::setUp in lib/Drupal/views/Tests/Handler/AreaTextTest.php
Sets up a Drupal site for running functional and integration tests.
ArgumentDefaultTest::setUp in lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php
Sets up a Drupal site for running functional and integration tests.

... See full list

File

lib/Drupal/views/Tests/ViewTestBase.php, line 49
Definition of Drupal\views\Tests\ViewTestBase.

Class

ViewTestBase
Abstract class for views testing.

Namespace

Drupal\views\Tests

Code

protected function enableViewsTestModule() {

  // Define the schema and views data variable before enabling the test module.
  variable_set('views_test_data_schema', $this
    ->schemaDefinition());
  variable_set('views_test_data_views_data', $this
    ->viewsData());
  module_enable(array(
    'views_test_data',
  ));
  $this
    ->resetAll();

  // 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();
  $this
    ->checkPermissions(array(), TRUE);

  // Reset the test view, in case it was dependent on the test data module.
  $this->view = $this
    ->getBasicView();
}