protected function get_local_timestamp(ActionScheduler_Action $action, DateTime $date = NULL) { $next = is_null($date) ? $action->get_schedule()->next() : $date; if (!$next) { throw new InvalidArgumentException(__('Invalid schedule. Cannot save action.', 'action-scheduler')); } $next->setTimezone($this->get_local_timezone()); return $next->format('Y-m-d H:i:s'); }
public function test_execute() { $mock = new MockAction(); $random = md5(rand()); add_action($random, array($mock, 'action')); $action = new ActionScheduler_Action($random, array($random)); $action->execute(); remove_action($random, array($mock, 'action')); $this->assertEquals(1, $mock->get_call_count()); $events = $mock->get_events(); $event = reset($events); $this->assertEquals($random, reset($event['args'])); }
protected function schedule_next_instance(ActionScheduler_Action $action) { $next = $action->get_schedule()->next(new DateTime()); if ($next) { $this->store->save_action($action, $next); } }
protected function schedule_next_instance(ActionScheduler_Action $action) { $next = $action->get_schedule()->next(as_get_datetime_object()); if ($next) { $this->store->save_action($action, $next); } }