You are here

public function SimpleTestUnitTestExampleTestCase::setUp in Examples for Developers 7

Set up the test environment.

Note that we use drupal_load() instead of passing our module dependency to parent::setUp(). That's because we're using DrupalUnitTestCase, and thus we don't want to install the module, only load it's code.

Also, DrupalUnitTestCase can't actually install modules. This is by design.

Overrides DrupalUnitTestCase::setUp

File

simpletest_example/simpletest_example.test, line 162
An example of simpletest tests to accompany the tutorial at http://drupal.org/node/890654.

Class

SimpleTestUnitTestExampleTestCase
Although most core test cases are based on DrupalWebTestCase and are functional tests (exercising the web UI) we also have DrupalUnitTestCase, which executes much faster because a Drupal install does not have to be one. No environment is provided to a…

Code

public function setUp() {
  drupal_load('module', 'simpletest_example');
  parent::setUp();
}