protected function getSecurityAdmin()
 {
     $member = $this->objFromFixture('Member', 'unconfirmed');
     $admin = new SecurityAdmin();
     $group = $this->objFromFixture('Group', 'group');
     Form::disable_all_security_tokens();
     $this->logInWithPermission('ADMIN');
     $gLink = Controller::join_links($admin->Link(), 'show', $group->ID);
     $mLink = Controller::join_links($admin->Link(), 'EditForm/field/Members/item', $member->ID, 'edit');
     $this->get($gLink);
     $this->get($mLink);
 }
Example #2
0
 function testNotifyModerators()
 {
     Form::disable_all_security_tokens();
     $notifyModerators = Forum::$notify_moderators;
     Forum::$notify_moderators = true;
     $forum = $this->objFromFixture('Forum', 'general');
     $controller = new Forum_Controller($forum);
     $user = $this->objFromFixture('Member', 'test1');
     $this->session()->inst_set('loggedInAs', $user->ID);
     // New thread
     $this->post($forum->RelativeLink('PostMessageForm'), array('Title' => 'New thread', 'Content' => 'Meticulously crafted content', 'action_doPostMessageForm' => 1));
     $this->assertEmailSent('*****@*****.**', Email::getAdminEmail(), "New thread \"New thread\" in forum [General Discussion]");
     $this->clearEmails();
     // New response
     $thread = DataObject::get_one('ForumThread', "\"ForumThread\".\"Title\"='New thread'");
     $this->post($forum->RelativeLink('PostMessageForm'), array('Title' => 'Re: New thread', 'Content' => 'Rough response', 'ThreadID' => $thread->ID, 'action_doPostMessageForm' => 1));
     $this->assertEmailSent('*****@*****.**', Email::getAdminEmail(), "New post \"Re: New thread\" in forum [General Discussion]");
     $this->clearEmails();
     // Edit
     $post = $thread->Posts()->Last();
     $this->post($forum->RelativeLink('PostMessageForm'), array('Title' => 'Re: New thread', 'Content' => 'Pleasant response', 'ThreadID' => $thread->ID, 'ID' => $post->ID, 'action_doPostMessageForm' => 1));
     $this->assertEmailSent('*****@*****.**', Email::getAdminEmail(), "New post \"Re: New thread\" in forum [General Discussion]");
     $this->clearEmails();
     Forum::$notify_moderators = $notifyModerators;
 }