/**
  * Test delete schedule
  */
 public function testDelete()
 {
     $scheduleDocument = $this->getMockObject('Litvinab\\Bundle\\CronEventBundle\\Document\\Schedule');
     $model = $this->getMockObject('Litvinab\\Bundle\\CronEventBundle\\Model\\ScheduleModel', ['removeSchedule']);
     $cronEvent = new CronEvent($model);
     $cronEvent->setSchedule($scheduleDocument);
     $cronEvent->delete();
     $this->assertTrue(true);
 }
Exemple #2
0
 /**
  * Run schedules
  *
  * @return void
  */
 public function runSchedules()
 {
     $this->model->updateAllTypeStatus();
     $schedules = $this->model->getExpiredAndEnabledSchedules();
     foreach ($schedules as $schedule) {
         $event = new CronEvent($this->model);
         $event->setSchedule($schedule);
         $this->dispatcher->dispatch('cron_event.' . $schedule->getEvent(), $event);
     }
 }