private function ForumAccessTestCase::testForumAccessCreateUser in Forum Access 6
Wrapper function for drupalCreateUser
1 call to ForumAccessTestCase::testForumAccessCreateUser()
- ForumAccessTestCase::testForumAccessRun in ./
forum_access.test - The main function which is used to start testing a specific forum configuration.
File
- ./
forum_access.test, line 1084 - Test file for forum_access.module.
Class
- ForumAccessTestCase
- This is the base class for forum access testing.
Code
private function testForumAccessCreateUser($name = '', $permissions = array()) {
if (empty($name)) {
$name = 'User name: ' . $this
->randomName(16);
}
$delete_permissions = FALSE;
if (count($permissions) == 0) {
$delete_permissions = TRUE;
$permissions = array(
'access comments',
'access content',
'post comments',
'post comments without approval',
);
// default permissions
}
if ($this->testForumAccessUseDNA) {
$permissions[] = 'view devel_node_access information';
}
if ($name == 'admin_user') {
$this->testForumAccessAdminUser = $this
->drupalCreateUser($permissions);
}
else {
$this->testForumAccessUsers[$name] = $this
->drupalCreateUser($permissions);
}
if ($delete_permissions) {
$permissions = array();
if ($name == 'admin_user') {
$this
->testForumAccessDeletePermissionsUser($this->testForumAccessAdminUser->uid);
}
else {
$this
->testForumAccessDeletePermissionsUser($this->testForumAccessUsers[$name]->uid);
}
$this
->pass('The permissions are deleted for user: ' . $name, 'Debug');
}
$this->testForumAccessPermissions[$name] = $permissions;
if ($name == 'admin_user') {
$this->testForumAccessUidToName[$this->testForumAccessAdminUser->uid] = $name;
}
else {
$this->testForumAccessUidToName[$this->testForumAccessUsers[$name]->uid] = $name;
}
}