1 user.test private UserRolesAssignmentTestCase::userLoadAndCheckRoleAssigned($account, $role_name, $is_assigned = TRUE)

Check role on user object.

Parameters

object $account User.:

integer $role_name Role name.:

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

File

core/modules/user/tests/user.test, line 2731
Tests for user.module.

Class

UserRolesAssignmentTestCase
Test role assignment.

Code

private function userLoadAndCheckRoleAssigned($account, $role_name, $is_assigned = TRUE) {
  $account = user_load($account->uid, TRUE);
  if ($is_assigned) {
    $this->assertTrue(in_array($role_name, $account->roles), 'The role is present in the user object.');
  }
  else {
    $this->assertFalse(in_array($role_name, $account->roles), 'The role is not present in the user object.');
  }
}