You are here

public function SearchByPageAttachTest::setUpUsers in Search by Page 8

Sets up superuser and low-privilege user.

4 calls to SearchByPageAttachTest::setUpUsers()
SearchbyPageAttach2Test::setUp in tests/src/Functional/search_by_page.test
SearchbyPageAttachNotReadable::setUp in tests/src/Functional/search_by_page.test
SearchbyPageAttachReindexTest::setUp in tests/src/Functional/search_by_page.test
SearchByPageAttachTest::setUp in tests/src/Functional/search_by_page.test

File

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

Class

SearchByPageAttachTest
Functionality test 1 for Search by Page Attachments.

Namespace

Drupal\Tests\search_by_page\Functional

Code

public function setUpUsers($env) {
  $this->superuser = $this
    ->drupalCreateUser(array(
    'administer nodes',
    'access content',
    'administer content types',
    'administer blocks',
    'administer search',
    'search content',
    'administer search by page',
    'access administration pages',
    $this
      ->searchPerm($env),
    'administer site configuration',
    'administer users',
    'administer permissions',
    'view test private content',
    'administer search_files configuration',
    'access site reports',
  ));
  $this->noprivuser = $this
    ->drupalCreateUser(array(
    $this
      ->searchPerm($env),
    'search content',
  ));

  // Clear default permissions for authenticated users.
  \Drupal::database()
    ->delete('role_permission')
    ->condition('rid', AccountInterface::AUTHENTICATED_ROLE)
    ->execute();
  $this
    ->assertFalse(user_access('access content', $this->noprivuser), 'No priv user cannot access content');
  $this
    ->drupalLogin($this->superuser);
}