public function testContestPage() { $user = $this->user; $contest = $this->contest; // save two jurytalk entries require_once WCF_DIR . 'lib/data/contest/jurytalk/ContestJurytalkEditor.class.php'; $this->deleteArray[] = $jurytalk = ContestJurytalkEditor::create($contestID = $contest->contestID, $jurytalk = __METHOD__ . ' jurytalk #1', $userID = $user->userID, $username = $user->username); $this->deleteArray[] = $jurytalk = ContestJurytalkEditor::create($contestID = $contest->contestID, $jurytalk = __METHOD__ . ' jurytalk #2', $userID = $user->userID, $username = $user->username); $raised = false; try { $this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID); } catch (Exception $e) { $raised = true; } $this->assertTrue($raised, "user should not be allowed to access a private contest"); // now try with owner $this->setCurrentUser($user); $this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID); $this->assertEquals(count(WCF::getTPL()->get('jurytalks')), 2); // now try with jury member who was invited $this->deleteArray[] = $juryuser = $this->createUser(); require_once WCF_DIR . 'lib/data/contest/jury/ContestJuryEditor.class.php'; $this->deleteArray[] = $jury = ContestJuryEditor::create($contestID = $contest->contestID, $userID = $juryuser->userID, $groupID = 0, $state = 'invited'); $this->setCurrentUser($juryuser); $this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID); // invited members should only see first entry $this->assertEquals(count(WCF::getTPL()->get('jurytalks')), 1); // accepted members should have 2 entries $jury->update($contestID, $userID, $groupID, 'accepted'); $this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID); $this->assertEquals(count(WCF::getTPL()->get('jurytalks')), 2); }
/** * @see Form::save() */ public function save() { parent::save(); // save jurytalk $jurytalk = ContestJurytalkEditor::create($this->contest->contestID, $this->message, WCF::getUser()->userID, WCF::getUser()->username); $this->saved(); // forward HeaderUtil::redirect('index.php?page=ContestJurytalk&contestID=' . $this->contest->contestID . '&jurytalkID=' . $jurytalk->jurytalkID . SID_ARG_2ND_NOT_ENCODED . '#jurytalk' . $jurytalk->jurytalkID); exit; }
public function testReflectionAPI() { require_once WCF_DIR . 'lib/data/contest/jurytalk/ContestJurytalkEditor.class.php'; $this->deleteArray[] = $jurytalk = ContestJurytalkEditor::create($contestID = 0, $jurytalk = __METHOD__ . ' jurytalk', $userID = 0, $username = __METHOD__ . ' username'); $this->callAllMethodsWithoutRequiredParameters($jurytalk); }
/** * @see Form::save() */ public function save() { parent::save(); $state = 'private'; // save entry $entry = ContestEditor::create($this->userID, $this->groupID, $this->subject, $this->text, $this->getOptions(), $state, $this->classIDArray, $this->participants, $this->jurys, $this->prices, $this->sponsors, $this->attachmentListEditor); $this->saved(); $contestID = $entry->contestID; if ($this->sponsortalk_trigger) { require_once WCF_DIR . 'lib/data/contest/sponsortalk/ContestSponsortalkEditor.class.php'; $sponsortalk = ContestSponsortalkEditor::create($contestID, $this->sponsortalk_message, WCF::getUser()->userID, WCF::getUser()->username); } if ($this->jurytalk_trigger) { require_once WCF_DIR . 'lib/data/contest/jurytalk/ContestJurytalkEditor.class.php'; $jurytalk = ContestJurytalkEditor::create($contestID, $this->jurytalk_message, WCF::getUser()->userID, WCF::getUser()->username); } if ($this->comment_trigger) { require_once WCF_DIR . 'lib/data/contest/comment/ContestCommentEditor.class.php'; $comment = ContestCommentEditor::create($contestID, $this->comment_message, WCF::getUser()->userID, WCF::getUser()->username); } // save tags if (MODULE_TAGGING) { $tagArray = TaggingUtil::splitString($this->tags); if (count($tagArray)) { $entry->updateTags($tagArray); } } // forward HeaderUtil::redirect('index.php?page=Contest&contestID=' . $entry->contestID . SID_ARG_2ND_NOT_ENCODED); exit; }