public function testLog() { $message = 'php artisan'; $this->output->shouldReceive('writeln')->once()->with($message); $debugger = new Debugger($this->optionReader, $this->output); $debugger->log($message); }
/** * Run all commands that are due to be run */ public function runDue(Debugger $debugger) { $debugger->log('Running commands...'); /** @var \Indatus\Dispatcher\BackgroundProcessRunner $backgroundProcessRunner */ $backgroundProcessRunner = App::make('Indatus\\Dispatcher\\BackgroundProcessRunner'); /** @var \Indatus\Dispatcher\Queue $queue */ $queue = $this->scheduleService->getQueue($debugger); foreach ($queue->flush() as $queueItem) { /** @var \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $command */ $command = $queueItem->getCommand(); //determine if the command is enabled if ($command->isEnabled()) { if ($this->runnableInCurrentMaintenanceSetting($command)) { if ($this->runnableInEnvironment($command)) { $scheduler = $queueItem->getScheduler(); $backgroundProcessRunner->run($command, $scheduler->getArguments(), $scheduler->getOptions(), $debugger); } else { $debugger->commandNotRun($command, 'Command is not configured to run in ' . App::environment()); } } else { $debugger->commandNotRun($command, 'Command is not configured to run while application is in maintenance mode'); } } else { $debugger->commandNotRun($command, 'Command is disabled'); } } }