You are here

function DatabaseTestCase::setUp in Drupal 7

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()

5 calls to DatabaseTestCase::setUp()
DatabaseBasicSyntaxTestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.
DatabaseFetch2TestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.
DatabaseInvalidDataTestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.
DatabaseQueryTestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.
DatabaseReservedKeywordTestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.
6 methods override DatabaseTestCase::setUp()
DatabaseBasicSyntaxTestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.
DatabaseFetch2TestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.
DatabaseInvalidDataTestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.
DatabaseQueryTestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.
DatabaseReservedKeywordTestCase::setUp in modules/simpletest/tests/database_test.test
Sets up a Drupal site for running functional and integration tests.

... See full list

File

modules/simpletest/tests/database_test.test, line 21

Class

DatabaseTestCase
Base test class for databases.

Code

function setUp() {
  parent::setUp('database_test');
  $schema['test'] = drupal_get_schema('test');
  $schema['test_people'] = drupal_get_schema('test_people');
  $schema['test_people_copy'] = drupal_get_schema('test_people_copy');
  $schema['test_one_blob'] = drupal_get_schema('test_one_blob');
  $schema['test_two_blobs'] = drupal_get_schema('test_two_blobs');
  $schema['test_task'] = drupal_get_schema('test_task');
  $this
    ->installTables($schema);
  $this
    ->addSampleData();
}