Exemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     /** @var \Indatus\Dispatcher\OptionReader $optionReader */
     $optionReader = App::make('Indatus\\Dispatcher\\OptionReader', array($this->option()));
     /** @var \Indatus\Dispatcher\Debugger $debugger */
     $debugger = App::make('Indatus\\Dispatcher\\Debugger', array($optionReader, $this->getOutput()));
     $this->commandService->runDue($debugger);
 }
 /**
  * Run a scheduled command
  *
  * @param  \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $scheduledCommand
  * @param  array                                                    $arguments
  * @param  array                                                    $options
  * @return bool
  */
 public function run(ScheduledCommandInterface $scheduledCommand, array $arguments = [], array $options = [], Debugger $debugger = null)
 {
     $runCommand = $this->commandService->getRunCommand($scheduledCommand, $arguments, $options);
     if (!is_null($debugger)) {
         $debugger->commandRun($scheduledCommand, $runCommand);
     }
     exec($runCommand);
     return true;
 }
 public function testGetRunCommandAsUser()
 {
     $user = '******';
     $commandName = 'test:command';
     $scheduledCommand = $this->mockCommand();
     $scheduledCommand->shouldReceive('getName')->andReturn($commandName);
     $scheduledCommand->shouldReceive('user')->andReturn($user);
     $this->assertEquals($this->commandService->getRunCommand($scheduledCommand), implode(' ', array('sudo -u ' . $user, '/usr/bin/env', 'php', base_path() . '/artisan', $commandName, '> /dev/null', '&')));
 }
Exemplo n.º 4
0
 public function testGetRunCommandAsUser()
 {
     $user = '******';
     $commandName = 'test:command';
     $scheduledCommand = $this->mockCommand();
     $scheduledCommand->shouldReceive('getName')->andReturn($commandName);
     $scheduledCommand->shouldReceive('user')->andReturn($user);
     $this->assertEquals($this->commandService->getRunCommand($scheduledCommand), implode(' ', ['sudo -u ' . $user, PHP_BINARY, base_path() . '/artisan', $commandName, '--env=' . App::environment(), '> /dev/null', '&']));
 }