/**
  * @When /^I run "([^"]*)" command$/
  */
 public function iRunCommand($cmd_line)
 {
     $input = new StringInput($cmd_line);
     $command = $this->application->find($input->getFirstArgument('command'));
     $input = new StringInput($cmd_line, $command->getDefinition());
     $this->output = new StreamOutput(fopen('php://memory', 'w', false));
     $command->run($input, $this->output);
 }
Ejemplo n.º 2
0
 /**
  * Get the command from the current input, takes aliases into account.
  *
  * @param string $input
  *   The raw input
  *
  * @return string|NULL
  *   The current command.
  */
 protected function getCommandFromInput($input)
 {
     // Remove the alias from the start of the string before parsing and
     // returning the command. Essentially, when choosing a command, we're
     // ignoring the site alias.
     $input = preg_replace('|^\\@[^\\s]+|', '', $input);
     $input = new StringInput($input);
     return $input->getFirstArgument();
 }
Ejemplo n.º 3
0
 /**
  * handle.
  *
  * @throws \InvalidArgumentException
  */
 public function fire()
 {
     $command = $this->option('command');
     if ($this->needForce($command) === true) {
         $command .= ' --force';
     }
     $input = new StringInput($command);
     $input->setInteractive(false);
     if (isset($this->notSupport[$input->getFirstArgument()]) === true) {
         throw new InvalidArgumentException('Command "' . $command . '" is not supported');
     }
     $this->artisan->handle($input, $this->getOutput());
 }
 /**
  * Get a command (if one exists) for the current input string.
  *
  * @param string $input
  *
  * @return null|Command
  */
 protected function getCommand($input)
 {
     $input = new StringInput($input);
     if ($name = $input->getFirstArgument()) {
         return $this->get($name);
     }
 }