protected function run_cleanup() { $cleaner = new ActionScheduler_QueueCleaner($this->store); $cleaner->delete_old_actions(); $cleaner->reset_timeouts(); $cleaner->mark_failures(); }
public function test_do_not_delete_recent_actions() { $store = new ActionScheduler_wpPostStore(); $runner = new ActionScheduler_QueueRunner($store); $random = md5(rand()); $schedule = new ActionScheduler_SimpleSchedule(new DateTime('1 day ago')); $created_actions = array(); for ($i = 0; $i < 5; $i++) { $action = new ActionScheduler_Action($random, array($random), $schedule); $created_actions[] = $store->save_action($action); } $runner->run(); $cleaner = new ActionScheduler_QueueCleaner($store); $cleaner->delete_old_actions(); foreach ($created_actions as $action_id) { $action = $store->fetch_action($action_id); $this->assertTrue($action->is_finished()); // It's a FinishedAction } }