You are here

public function ViewsSqlTest::setUp in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 tests/views_query.test \ViewsSqlTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Generates a random database prefix and installs Drupal with the specified installation profile in DrupalWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides DrupalWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

25 calls to ViewsSqlTest::setUp()
ViewsAccessTest::setUp in tests/views_access.test
Sets up a Drupal site for running functional and integration tests.
ViewsAjaxTest::setUp in tests/views_ajax.test
Sets up a Drupal site for running functional and integration tests.
ViewsAnalyzeTest::setUp in tests/views_analyze.test
Sets up a Drupal site for running functional and integration tests.
ViewsArgumentDefaultTest::setUp in tests/views_argument_default.test
Sets up a Drupal site for running functional and integration tests.
ViewsCloneTest::setUp in tests/views_clone.test
Sets up a Drupal site for running functional and integration tests.

... See full list

25 methods override ViewsSqlTest::setUp()
ViewsAccessTest::setUp in tests/views_access.test
Sets up a Drupal site for running functional and integration tests.
ViewsAjaxTest::setUp in tests/views_ajax.test
Sets up a Drupal site for running functional and integration tests.
ViewsAnalyzeTest::setUp in tests/views_analyze.test
Sets up a Drupal site for running functional and integration tests.
ViewsArgumentDefaultTest::setUp in tests/views_argument_default.test
Sets up a Drupal site for running functional and integration tests.
ViewsCloneTest::setUp in tests/views_clone.test
Sets up a Drupal site for running functional and integration tests.

... See full list

File

tests/views_query.test, line 182
Abstract class for views testing.

Class

ViewsSqlTest

Code

public function setUp(array $modules = array()) {
  $modules[] = 'views';
  $modules[] = 'views_ui';
  parent::setUp($modules);

  // Define the schema and views data variable before enabling the test
  // module.
  variable_set('views_test_schema', $this
    ->schemaDefinition());
  variable_set('views_test_views_data', $this
    ->viewsData());
  variable_set('views_test_views_plugins', $this
    ->viewsPlugins());
  module_enable(array(
    'views_test',
  ));
  $this
    ->resetAll();

  // Load the test dataset.
  $data_set = $this
    ->dataSet();
  $query = db_insert('views_test')
    ->fields(array_keys($data_set[0]));
  foreach ($data_set as $record) {
    $query
      ->values($record);
  }
  $query
    ->execute();
  $this
    ->checkPermissions(array(), TRUE);
}