You are here

function MerciIssueTestCase::setUp in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.2

Same name and namespace in other branches
  1. 6.2 tests/merci_issues.test \MerciIssueTestCase::setUp()

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 MerciTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

File

tests/merci_issues.test, line 25

Class

MerciIssueTestCase

Code

function setUp() {

  // Enable the module.
  parent::setUp();
  $this->bucket1 = $this
    ->merciCreateItem('bucket');
  $this->bucket2 = $this
    ->merciCreateItem('bucket');
  $this->resource = $this
    ->merciCreateItem('resource');
  $this->merci_role = $this
    ->drupalCreateRole(array(
    'view revisions',
    'revert revisions',
    'create confirmed reservations',
    'edit own bucket content',
    'delete own bucket content',
    'edit own resource content',
    'delete own resource content',
    'create reservations',
  ));

  // Create merci user.
  $this->merci_user = $this
    ->drupalCreateUser(array(
    'view revisions',
    'revert revisions',
    'create confirmed reservations',
    'edit own bucket content',
    'delete own bucket content',
    'edit own resource content',
    'delete own resource content',
    'create reservations',
    //'access devel information',
    'create merci_reservation content',
    'edit own merci_reservation content',
    'delete own merci_reservation content',
  ));
  $edit = array(
    'roles' => $this->merci_user->roles + array(
      $this->merci_role => $this->merci_role,
    ),
  );
  user_save($this->merci_user, $edit);
  $edit = array(
    'roles' => $this->admin_user->roles + array(
      $this->merci_role => $this->merci_role,
    ),
  );
  user_save($this->admin_user, $edit);
}