$articlePublishObj2 = new ArticlePublish($newArticle->getArticleId(), 1, $datetime); $articlePublishObj2->create(); $articlePublishObj2->setPublishAction('P'); // Verify echo "Number of pending actions (should be zero): ".count(ArticlePublish::GetPendingActions())."<br>"; // Schedule past event echo "Scheduling past event...<br>"; $datetime = strftime("1900-%m-%d %H:%M:00"); $articlePublishObj3 = new ArticlePublish($newArticle->getArticleId(), 1, $datetime); $articlePublishObj3->create(); $articlePublishObj3->setPublishAction('P'); // Verify echo "Number of pending actions (should be one): ".count(ArticlePublish::GetPendingActions())."<br>"; // delete the article echo "Deleting the article.<br>"; $newArticle->delete(); echo "Deleting the events.<br>"; $articlePublishObj->delete(); $articlePublishObj2->delete(); $articlePublishObj3->delete(); echo "<h2>ISSUE AUTOPUBLISH TESTS</h2>"; echo "Creating an issue...<br>"; $issueId = rand(); $issue = new Issue(1, 1, $issueId); $issue->create($issueId);
/** * Execute all pending actions. * @return void */ public static function DoPendingActions() { $actions = ArticlePublish::GetPendingActions(); foreach ($actions as $articlePublishObj) { $articlePublishObj->doAction(); } if (count($actions) > 0) { CampCache::singleton()->clear('user'); } return count($actions); } // fn DoPendingActions