private function ForumAccessTestCase::testForumAccessAddModerator in Forum Access 6
This function adds a user as a moderator to a forum (must be used by the admin user!)
1 call to ForumAccessTestCase::testForumAccessAddModerator()
- ForumAccessTestCase::testForumAccessRun in ./
forum_access.test - The main function which is used to start testing a specific forum configuration.
File
- ./
forum_access.test, line 1154 - Test file for forum_access.module.
Class
- ForumAccessTestCase
- This is the base class for forum access testing.
Code
private function testForumAccessAddModerator($uid = 0) {
if ($this->testForumAccessCurrentUsername == 'admin_user' && intval($this->testForumAccessCurrentForumId) > 0 && intval($uid) > 0) {
if ($uid > 0) {
$forum_options = array(
'forum_access[acl][add]' => $this->testForumAccessUsers[$this->testForumAccessUidToName[$uid]]->name,
);
$this
->drupalPost('admin/content/forum/edit/forum/' . $this->testForumAccessCurrentForumId, $forum_options, t('Add User'));
$this
->drupalPost(NULL, $forum_options, t('Save'));
if (!$this
->assertNoText("not authorized", t('@user should be allowed to add moderators to a forum: @page', array(
'@user' => $this->loggedInUser ? t('The user') : t('Anonymous'),
'@page' => $this
->getUrl(),
)))) {
$this
->testForumAccessDumpDebugInfo();
}
else {
array_push($this->testForumAccessModerators, $uid);
}
}
}
}