You are here

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

Same name and namespace in other branches
  1. 6.2 tests/merci_testcase.php \MerciTestCase::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 DrupalWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

5 calls to MerciTestCase::setUp()
MerciAdminTestCase::setUp in tests/merci_admin.test
Sets up a Drupal site for running functional and integration tests.
MerciBucketTestCase::setUp in tests/merci_bucket.test
Sets up a Drupal site for running functional and integration tests.
MerciIssueTestCase::setUp in tests/merci_issues.test
Sets up a Drupal site for running functional and integration tests.
MerciResourceTestCase::setUp in tests/merci_resource.test
Sets up a Drupal site for running functional and integration tests.
MerciUserTestCase::setUp in tests/merci_user.test
Sets up a Drupal site for running functional and integration tests.
5 methods override MerciTestCase::setUp()
MerciAdminTestCase::setUp in tests/merci_admin.test
Sets up a Drupal site for running functional and integration tests.
MerciBucketTestCase::setUp in tests/merci_bucket.test
Sets up a Drupal site for running functional and integration tests.
MerciIssueTestCase::setUp in tests/merci_issues.test
Sets up a Drupal site for running functional and integration tests.
MerciResourceTestCase::setUp in tests/merci_resource.test
Sets up a Drupal site for running functional and integration tests.
MerciUserTestCase::setUp in tests/merci_user.test
Sets up a Drupal site for running functional and integration tests.

File

tests/merci_testcase.php, line 19
Simpletest case for node_example module.

Class

MerciTestCase
Functionality tests for merci module. General setup and functions all merci tests should inherit.

Code

function setUp() {

  // Enable the module.
  parent::setUp('merci');
  $perms = user_permission_get_modules();
  $this
    ->verbose('perms: ' . var_export($perms, TRUE));

  // Create admin user.
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'administer nodes',
    // Required to set revision checkbox
    'bypass node access',
    'administer content types',
    'access administration pages',
    'administer site configuration',
    'view revisions',
    'revert revisions',
    //'access devel information',
    'administer MERCI',
    'manage reservations',
  ));

  // Login the admin user.
  $this
    ->drupalLogin($this->admin_user);
  $settings = array(
    'merci_default_reservation_status' => '2',
    'merci_max_days_advance_reservation' => '0',
    'merci_saturday_is_weekend' => '1',
    'merci_sunday_is_weekend' => '1',
    'merci_hours_monday' => '09:00-17:00',
    'merci_hours_tuesday' => '09:00-17:00',
    'merci_hours_wednesday' => '09:00-17:00',
    'merci_hours_thursday' => '09:00-17:00',
    'merci_hours_friday' => '09:00-17:00',
    'merci_hours_saturday' => '09:00-17:00',
    'merci_hours_sunday' => '09:00-17:00',
    'merci_hours_admin' => '07:00-22:00',
    'merci_closed_dates' => '12-25',
    'merci_lock' => FALSE,
  );
  $this
    ->merciCreateConfig($settings);
  $settings = array(
    'date_default_timezone' => 'America/Los_Angeles',
  );
  $this
    ->drupalPost('admin/config/regional/settings', $settings, t('Save configuration'));
  $this
    ->assertText(t("The configuration options have been saved."));

  /*
  $settings = array (
    'instance[widget][settings][input_format]' => 'Y-m-d H:i:s',
  );
  $this->drupalPost('admin/structure/types/manage/merci-reservation/fields/field_merci_date', $settings, t('Save settings'));
  $this->assertText(t("Saved Reservation configuration"));
  */
}