function AAR::getEditValues in Auto Assign Role 6
Same name and namespace in other branches
- 6.2 tests/autoassignrole.test \AAR::getEditValues()
Helper function that compares the edit array to AAR settings
7 calls to AAR::getEditValues()
- AutoassignroleAdminAllowUserChoiceTestCase::testAdminSettings in tests/
autoassignrole.test - AutoassignroleAdminAssignFromPathTestCase::testAdminSettings in tests/
autoassignrole.test - AutoassignroleAdminAutoRoleTestCase::testAdminSettings in tests/
autoassignrole.test - AutoassignroleUserAutoRoleTestCase::testAutomaticRoleAssignment in tests/
autoassignrole.test - AutoassignroleUserChoiceTestCase::testUserChoiceAssignment in tests/
autoassignrole.test
File
- tests/
autoassignrole.test, line 42 - Autoassignrole functionality tests.
Class
- AAR
- @file Autoassignrole functionality tests.
Code
function getEditValues($key) {
$edit = array();
switch ($key) {
case 'automatic_role_assignment':
$edit = array(
'auto_active' => 1,
);
foreach ($this->roles as $rid => $role) {
$edit["auto_roles[{$rid}]"] = TRUE;
}
break;
case 'assign_from_path':
// path and title are required for enabling Assign From Path
foreach ($this->roles as $rid => $role) {
$edit["path_active_{$rid}"] = 1;
$edit["path_weight_{$rid}"] = -10;
$edit["path_{$rid}"] = $this
->randomName();
$edit["path_title_{$rid}"] = $this
->randomName();
$edit["path_description_{$rid}"] = $this
->randomName(100);
$edit["path_display_{$rid}"] = 1;
}
break;
case 'user_choice':
$edit['user_active'] = 1;
$edit['user_multiple'] = 1;
$edit['user_selection'] = 1;
$edit['user_required'] = 0;
$edit['user_sort'] = 'SORT_ASC';
$edit['user_fieldset_title'] = $this
->randomName();
$edit['user_title'] = $this
->randomName();
$edit['user_description'] = $this
->randomName(100);
foreach ($this->roles as $rid => $role) {
$edit["user_roles[{$rid}]"] = TRUE;
}
break;
}
return $edit;
}