1 node.test NodeRevisionsTestCase::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





core/modules/node/tests/node.test, line 166
Tests for node.module.


Tests the node revision functionality.


function setUp() {

  // Make sure we're using UTC

  // Create and login user.
  $web_user = $this->backdropCreateUser(array(
    'view revisions',
    'revert revisions',
    'edit any page content',
    'delete revisions',
    'delete any page content',
    'administer nodes',

  // Create initial node.
  $node = $this->backdropCreateNode();
  $settings = get_object_vars($node);
  $settings['revision'] = 1;
  $settings['is_active_revision'] = TRUE;

  $nodes = array();
  $logs = array();

  // Get original node.
  $nodes[] = $node;

  // Create three revisions.
  $revision_count = 3;
  for ($i = 0; $i < $revision_count; $i++) {
    $logs[] = $settings['log'] = $this->randomName(32);

    // Create revision with random title and body and update variables.
    // Make sure we get revision information.
    $node = node_load($node->nid);
    $settings = get_object_vars($node);
    $settings['is_active_revision'] = TRUE;

    $nodes[] = $node;

  $this->nodes = $nodes;
  $this->logs = $logs;