You are here

function WorkbenchAccessTestCase::getWorkbenchAccessUser in Workbench Access 7

Helper method for grabbing a new user from the list.

Parameters

$id: The array key of the current user being tested.

Return value

A user account from the user list.

3 calls to WorkbenchAccessTestCase::getWorkbenchAccessUser()
WorkbenchAccessMenuTestCase::testWorkbenchAccessMenu in tests/workbench_access.test
WorkbenchAccessRoleTestCase::testWorkbenchAccessRoles in tests/workbench_access.test
WorkbenchAccessTaxonomyTestCase::testWorkbenchAccessTaxonomy in tests/workbench_access.test

File

tests/workbench_access.test, line 145
Test file for Workbench Access.

Class

WorkbenchAccessTestCase
@file Test file for Workbench Access.

Code

function getWorkbenchAccessUser($id = NULL) {
  if (is_null($id)) {
    $id = array_rand($this->user_list);
  }
  elseif ($id < count($this->user_list) - 1) {
    $id++;
  }
  else {
    $id--;
  }
  $account = $this->user_list[$id];

  // Store the id key for later lookups.
  $account->testId = $id;
  return $account;
}