You are here

public function SearchByPageTester::getNewRoleID in Search by Page 7

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

Returns the unique role ID created by the testing framework.

15 calls to SearchByPageTester::getNewRoleID()
SearchbyPageAttach2Test::setUp in tests/search_by_page.test
Sets up a Drupal site for running functional and integration tests.
SearchByPageAttachTest::setUp in tests/search_by_page.test
Sets up a Drupal site for running functional and integration tests.
SearchByPageExtraUsersTest::setUp in tests/search_by_page.test
Sets up a Drupal site for running functional and integration tests.
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
Sets up a Drupal site for running functional and integration tests.

... See full list

File

tests/search_by_page.test, line 188
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;
}