private function AdministerUsersByRoleTestCase::createRolesAndUsers in Administer Users by Role 7
Same name and namespace in other branches
- 6 administerusersbyrole.test \AdministerUsersByRoleTestCase::createRolesAndUsers()
- 7.2 administerusersbyrole.test \AdministerUsersByRoleTestCase::createRolesAndUsers()
1 call to AdministerUsersByRoleTestCase::createRolesAndUsers()
- AdministerUsersByRoleTestCase::setUp in ./
administerusersbyrole.test - Sets up a Drupal site for running functional and integration tests.
File
- ./
administerusersbyrole.test, line 37 - Test Administer Users by Role.
Class
- AdministerUsersByRoleTestCase
- @file Test Administer Users by Role.
Code
private function createRolesAndUsers($roleName, $allowEditorToCancel) {
// create basic role
$this->roles[$roleName] = $this
->drupalCreateRole(array(
'access content',
), $roleName);
$this
->createUserWithRole($roleName, array(
$roleName,
));
// clear permissions cache, so we can use the 'edit users with ...' permission for this role
$this
->checkPermissions(array(), TRUE);
// create role to edit above role
$perms = array(
'access administration pages',
'access content',
'administer users',
_administerusersbyrole_build_perm_string($roleName, 'edit', FALSE),
);
if ($allowEditorToCancel) {
$perms[] = _administerusersbyrole_build_perm_string($roleName, 'cancel', FALSE);
}
$this->roles["{$roleName}_editor"] = $this
->drupalCreateRole($perms, "{$roleName}_editor");
$this
->createUserWithRole("{$roleName}_editor", array(
"{$roleName}_editor",
));
}