1 simpletest_example.test public SimpleTestExampleTestCase::setUp()

Set up the test environment.

This method is called once per test method, before the test is executed. It gives you a chance to control the setup of the test environment.

If you need a different test environment, then you should create another test class which overloads BackdropWebTestCase::setUp() differently.

Overrides BackdropWebTestCase::setUp

See also



modules/examples/simpletest_example/simpletest_example.test, line 39
An example of simpletest tests to accompany the tutorial at http://DOCUMENTATION_PENDING/node/890654.


The SimpleTestExampleTestCase is a functional test case, meaning that it actually exercises a particular sequence of actions through the web UI. The majority of core test cases are done this way, but the SimpleTest suite also provides unit tests as…


public function setUp() {
  // We call parent::setUp() with the list of modules we want to enable.
  // This can be an array or just a list of arguments.
  // Create and log in our user. The user has the arbitrary privilege
  // 'extra special edit any simpletest_example' which is provided by
  // our module to grant access.
  $this->privilegedUser = $this->backdropCreateUser(array('create simpletest_example content', 'extra special edit any simpletest_example'));