You are here

public function SearchByPageEnvironmentTest::setUp in Search by Page 6

Same name and namespace in other branches
  1. 7 tests/search_by_page.test \SearchByPageEnvironmentTest::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 DrupalWebTestCase::setUp

File

tests/search_by_page.test, line 273
Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageEnvironmentTest
Basic search environments test.

Code

public function setUp() {
  parent::setUp('search', 'search_by_page');
  $this
    ->setUpEnvironments();

  // Verify that environments are created
  $envs = search_by_page_list_environments();
  $this
    ->assertTrue(in_array($this->envid1, $envs), 'Environment 1 created');
  $this
    ->assertTrue(in_array($this->envid2, $envs), 'Environment 2 created');
  $perms = search_by_page_perm();
  $this
    ->assertTrue(in_array('search page environment ' . $this->envinfo1['environment_name'], $perms), 'Environment 1 perm created');
  $this
    ->assertTrue(in_array('search page environment ' . $this->envinfo2['environment_name'], $perms), 'Environment 2 perm created');
  $this
    ->assertEqual('search page environment ' . $this->envinfo1['environment_name'], $this
    ->searchPerm($this->envinfo1), 'searchPerm function working');
  $this->superuser = $this
    ->drupalCreateUser(array(
    'administer blocks',
    'access administration pages',
    'administer search',
    'administer search by page',
    'search content',
    $this
      ->searchPerm($this->envinfo1),
    $this
      ->searchPerm($this->envinfo2),
    'administer site configuration',
    'administer permissions',
  ));
  $this->user1 = $this
    ->drupalCreateUser(array(
    'search content',
    $this
      ->searchPerm($this->envinfo1),
  ));
  $this->user2 = $this
    ->drupalCreateUser(array(
    'search content',
    $this
      ->searchPerm($this->envinfo2),
  ));
}