You are here

function ForumAccessBaseTestCase::setUp in Forum Access 7

Implements setUp().

Overrides ForumTestCase::setUp

File

tests/forum_access_test_base.php, line 45
Base class with auxiliary functions for forum access module tests.

Class

ForumAccessBaseTestCase
Base test class for the Forum Access module.

Code

function setUp($modules = array()) {
  if (!isset($this->time)) {
    $this->time = time();
  }
  $this->timeLimit = 2345;
  $this
    ->pass("timeLimit set to {$this->timeLimit}.");
  parent::setUp();
  if (!module_exists('forum_access')) {
    module_enable(array(
      'acl',
      'chain_menu_access',
      'forum_access',
    ), FALSE);
  }
  $this
    ->assertTrue(module_exists('acl'), t('Module %module enabled!', array(
    '%module' => 'acl',
  )), 'Setup');
  $this
    ->assertTrue(module_exists('chain_menu_access'), t('Module %module enabled!', array(
    '%module' => 'chain_menu_access',
  )), 'Setup');
  $this
    ->assertTrue(module_exists('forum_access'), t('Module %module enabled!', array(
    '%module' => 'forum_access',
  )), 'Setup');
  $modules = array(
    'devel',
    'devel_node_access',
  ) + $modules;
  $files = system_rebuild_module_data();
  $available_modules = array();
  foreach ($modules as $module) {
    if (!empty($files[$module]) && !module_exists($module)) {
      $available_modules[] = $module;
    }
  }
  if (!empty($available_modules)) {
    module_enable($available_modules);
  }
  parent::resetAll();
  $this->accesses = array(
    'view',
    'create',
    'update',
    'delete',
  );
}