示例#1
0
 /**
  * Create Command.
  *
  * @param string   $expression
  * @param callable $callable
  *
  * @return \Symfony\Component\Console\Command\Command
  */
 protected function createCommand(string $expression, callable $callable) : SymfonyCommand
 {
     $result = $this->expressionParser->parse($expression);
     $command = new SymfonyCommand($result['name']);
     $command->getDefinition()->addArguments($result['arguments']);
     $command->getDefinition()->addOptions($result['options']);
     $command->setCode($callable);
     return $command;
 }
示例#2
0
 public function assertParsesTo($expression, $expected)
 {
     $parser = new ExpressionParser();
     $this->assertEquals($expected, $parser->parse($expression));
 }