You are here

public function SearchByPageTester::getNewRoleID in Search by Page 6

Same name and namespace in other branches
  1. 7 tests/search_by_page.test \SearchByPageTester::getNewRoleID()

Returns the unique role ID created by the testing framework.

11 calls to SearchByPageTester::getNewRoleID()
SearchByPageIntlTest::setupPath in tests/search_by_page.test
Sets up SBP Paths with a path to index.
SearchByPageNodesReindexTest::setUp in tests/search_by_page.test
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.…
SearchByPageNodesTest::setUp in tests/search_by_page.test
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.…
SearchByPageOutputTest::setUp in tests/search_by_page.test
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.…
SearchByPagePathsAliasTest::setUp in tests/search_by_page.test
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.…

... See full list

File

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

Class

SearchByPageTester
Base class for testing Search by Page.

Code

public function getNewRoleID($account) {
  $roles = $account->roles;
  $allroles = user_roles();
  foreach ($roles as $id => $name) {
    if ($id != DRUPAL_ANONYMOUS_RID && $id != DRUPAL_AUTHENTICATED_RID) {
      $this
        ->assertTrue(isset($allroles[$id]) && $allroles[$id], 'Found a role for new user and it exists');
      return $id;
    }
  }
  $this
    ->fail('Did not find a new role for new user');
  return DRUPAL_ANONYMOUS_RID;
}