public function SchedulerTestBase::schedule in Scheduler 7
Simulates the scheduled (un)publication of a node.
Parameters
object $node: The node to schedule.
string $action: The action to perform: either 'publish' or 'unpublish'. Defaults to 'publish'.
Return value
object The updated node, after scheduled (un)publication.
2 calls to SchedulerTestBase::schedule()
- SchedulerFunctionalTest::testAlterCreationDate in tests/
scheduler.test - Tests the 'touch' option to update the created date during publishing.
- SchedulerFunctionalTest::testRevisioning in tests/
scheduler.test - Tests the creation of new revisions on scheduling.
File
- tests/
scheduler.test, line 125 - Scheduler module test case file.
Class
- SchedulerTestBase
- Provides common helper methods for Scheduler module tests.
Code
public function schedule($node, $action = 'publish') {
// Simulate scheduling by setting the (un)publication date in the past and
// running cron.
$node->{$action . '_on'} = strtotime('-1 day', REQUEST_TIME);
node_save($node);
scheduler_cron();
return node_load($node->nid, NULL, TRUE);
}