/** * Iscrive un Post ad un Contest. * * @param post: il post da iscrivere. * @param contest: il contest a cui iscrivere il post * @return: il contest aggiornato. */ static function subscribePostToContest($post, $contest) { require_once "manager/ContestManager.php"; return ContestManager::subscribePostToContest($post, $contest); }
/** * Crea un post; * Crea un contest con il post nel contenuto; * Carica il contest e lo confronta con quello salvato in memoria; */ function testDeleteContest() { $data = $this->post_data_all; $p = PostManager::createPost($data); $data1 = $this->contest_data_all; $p1 = ContestManager::createContest($data1); $p2 = ContestManager::subscribePostToContest($p, $p1); $contest = ContestManager::loadContest($p2->getID()); //echo "<p>" . $p2 . "</p><p>" . $contest . "</p>"; //DEBUG if (count($p2->getSubscribers()) == 0) { return "<br />Contest deleting test NOT PASSED: not added"; } if (count($contest->getSubscribers()) == 0) { return "<br />Contest deleting test NOT PASSED: not loaded"; } $p1 = ContestManager::deleteContest($p2); $contest = ContestManager::loadContest($p1->getID()); //echo "<p>" . $p2 . "</p><p>" . $contest . "</p>"; //DEBUG if ($contest !== false) { return "<br />Contest deleting test NOT PASSED: loaded"; } return "<br />Contest deleting test passed"; }