UserRolesAssignmentTestCase::userLoadAndCheckRoleAssigned

7 user.test private UserRolesAssignmentTestCase::userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE)
8 user.test private UserRolesAssignmentTestCase::userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE)

Check role on user object.

Parameters

object $account User.:

integer $rid Role id.:

bool $is_assigned True if the role should present on the account.:

File

modules/user/user.test, line 2126
Tests for user.module.

Code

private function userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE) {
  $account = user_load($account->uid, TRUE);
  if ($is_assigned) {
    $this->assertTrue(array_key_exists($rid, $account->roles), t('The role is present in the user object.'));
  }
  else {
    $this->assertFalse(array_key_exists($rid, $account->roles), t('The role is not present in the user object.'));
  }
}
Login or register to post comments