You are here

public function SearchByPageEnvironmentTest::setUp in Search by Page 8

Overrides SearchByPageTesterTest::setUp

File

tests/src/Functional/SearchByPageEnvironmentTest.php, line 34
Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageEnvironmentTest
Basic search environments test.

Namespace

Drupal\Tests\search_by_page\Functional

Code

public function setUp() {
  parent::setUp();
  $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 = array_keys(search_by_page_permission());
  $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([
    '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([
    'search content',
    $this
      ->searchPerm($this->envinfo1),
  ]);
  $this->user2 = $this
    ->drupalCreateUser([
    'search content',
    $this
      ->searchPerm($this->envinfo2),
  ]);
}