private function UIFTestCaseRoles::userLoadAndCheckRoleAssigned in User Import Framework 7
Check role on user object.
Parameters
object $account: The user account to check.
string $rid: The role ID to search for.
bool $is_assigned: (optional) Whether to assert that $rid exists (TRUE) or not (FALSE). Defaults to TRUE.
1 call to UIFTestCaseRoles::userLoadAndCheckRoleAssigned()
- UIFTestCaseRoles::testUIFImportWithRoles in ./
uif.test - Test role import.
File
- ./
uif.test, line 449 - UIF test code.
Class
- UIFTestCaseRoles
- Test import with roles.
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.'));
}
}