public function testParseAndRunCommand() { $result = TaskRunner::parseAndRunCommand('vm\\cron_tests\\ActionMock::returnResult()'); $this->assertTrue($result); $result = TaskRunner::parseAndRunCommand('vm\\cron_tests\\ActionMock::wrongMethod()'); $this->assertFalse($result); TaskLoader::setClassFolder(__DIR__ . '/runner_mocks'); $result = TaskRunner::parseAndRunCommand('RunnerMock::anyMethod()'); $this->assertFalse($result); }
public function actionGetDates() { $time = $_POST['time']; $dates = TaskRunner::getRunDates($time); if (empty($dates)) { echo 'Invalid expression'; return; } echo '<ul>'; foreach ($dates as $d) { /** * @var \DateTime $d */ echo '<li>' . $d->format('Y-m-d H:i:s') . '</li>'; } echo '</ul>'; }
public function actionCheckTasks() { TaskRunner::checkAndRunTasks(Task::getAll()); }