You are here

function MerciUserTestCase::setUp in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6.2

Same name and namespace in other branches
  1. 7.2 tests/merci_user.test \MerciUserTestCase::setUp()

Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix. A temporary files directory is created with the same name as the database prefix.

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

File

tests/merci_user.test, line 29

Class

MerciUserTestCase

Code

function setUp() {

  // Enable the module.
  parent::setUp();
  $this->bucket1 = $this
    ->merciCreateItem('bucket');
  $this->bucket2 = $this
    ->merciCreateItem('bucket');
  $this->bucket3 = $this
    ->merciCreateItem('bucket');
  $this->resource = $this
    ->merciCreateItem('resource');
  $this->resource2 = $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',
  ));
  $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);
}