Exemplo n.º 1
0
 /**
  * @param string|null $type
  * @param string|null $expression
  * @return Schedule
  */
 public static function createSchedule($type = null, $expression = null)
 {
     $schedule = new Schedule();
     $schedule->setType($type);
     $schedule->setExpression($expression);
     return $schedule;
 }
Exemplo n.º 2
0
 /**
  * Updates a schedule
  *
  * @ParamType("type", type="string")
  * @ParamType("expression", type="string")
  *
  * @param string $type
  * @param string $expression
  */
 public function updateSchedule($type, $expression)
 {
     $schedule = new Schedule();
     $schedule->setType($type);
     $schedule->setExpression($expression);
     $this->job->removeSchedules();
     $this->job->addSchedule($schedule);
 }
 private function createSchedules($num)
 {
     $schedules = array();
     for ($i = 0; $i < $num; $i++) {
         $schedule = new Schedule();
         $schedule->setType('type');
         $schedules[] = $schedule;
     }
     return $schedules;
 }
Exemplo n.º 4
0
 public function testScheduleIsDisabledIfJobThrowsException()
 {
     // create scheduled job that throws an exception
     $schedule = new Schedule();
     $schedule->setExpression('* * * * *');
     $schedule->setType('cron');
     $ticket = $this->getJobManager()->addJob('throw_exception', array('message', 100), $schedule);
     // process schedules
     $this->runConsole("abc:scheduler:process", array("--iteration" => 1));
     $this->processJobs();
     $this->assertEquals(Status::ERROR(), $this->getJobManager()->get($ticket)->getStatus());
     $schedules = $this->getScheduleManager()->findSchedules();
     $this->assertCount(0, $schedules);
 }