1.20.x color.test public ColorTestCase::setUp()

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

Generates a random database prefix and installs Backdrop with the specified installation profile in BackdropWebTestCase::$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.


...: 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.

Return value

bool: TRUE if set up completes, FALSE if an error occurred.

Overrides BackdropWebTestCase::setUp

See also





modules/color/tests/color.test, line 20
Tests for color module.


Tests the Color module functionality.


public function setUp() {
  parent::setUp('color', 'config');

  // Create users.
  $this->bigUser = $this->backdropCreateUser(array(
    'administer themes',
    'access content',
    'administer site configuration',
    'synchronize configuration',

  // This tests the color module in Bartik.
  $this->themes = array(
    'bartik' => array(
      'palette_input' => 'palette[bg]',
      'scheme' => 'goldfish',
      'scheme_color' => '#3b3b3b',

  // Array filled with valid and not valid color values.
  $this->colorTests = array(
    '#000' => TRUE,
    '#123456' => TRUE,
    '#abcdef' => TRUE,
    '123456' => TRUE,
    '#0' => FALSE,
    '#00' => FALSE,
    '#0000' => FALSE,
    '#00000' => FALSE,
    '#00000g' => FALSE,