Esempio n. 1
0
 /**
  * @return void
  */
 public function test_it_can_detect_a_non_due_job_from_a_cron_expression()
 {
     $hour = date("H", strtotime('+1 hour'));
     $this->assertFalse($this->scheduleChecker->isDue("* {$hour} * * *"));
 }
Esempio n. 2
0
 /**
  * Run all jobs.
  */
 public function run()
 {
     $isUnix = $this->helper->getPlatform() === Helper::UNIX;
     if ($isUnix && !extension_loaded('posix')) {
         throw new Exception('posix extension is required');
     }
     $scheduleChecker = new ScheduleChecker();
     foreach ($this->jobs as $job => $config) {
         if (!$scheduleChecker->isDue($config['schedule'])) {
             continue;
         }
         if ($isUnix) {
             $this->runUnix($job, $config);
         } else {
             $this->runWindows($job, $config);
         }
     }
 }