public static function createCerebro(ContainerInterface $container) : Application
 {
     $console = new Application($container, $container->get(DispatcherContract::class), self::getConfig($container, 'version'), self::getConfig($container, 'name', 'Cerebro'));
     // Add auto-complete for Symfony Console application
     $console->add(new CompletionCommand());
     return $console;
 }
Exemplo n.º 2
0
 public function setUp()
 {
     $container = new ArrayContainer(['foo' => function (OutputInterface $output) {
         $output->write('hello');
     }]);
     $this->application = new Application($container, new Dispatcher($container), '1.0.0');
     $this->invoker = (new Invoker())->injectByTypeHint(true)->injectByParameterName(true)->setContainer($this->application->getContainer());
 }
Exemplo n.º 3
0
 /**
  * @param string $command
  * @param string $expected
  */
 private function assertOutputIs($command, $expected)
 {
     $output = new SpyOutput();
     $this->application->run(new StringInput($command), $output);
     $this->assertEquals($expected, $output->output);
 }
Exemplo n.º 4
0
 /**
  * Register a Closure based command with the application.
  *
  * @param string   $signature
  * @param \Closure $callback
  *
  * @return \Viserio\Console\Command\ClosureCommand
  */
 public function command(string $signature, Closure $callback)
 {
     $command = new ClosureCommand($signature, $callback);
     Cerebro::starting(function ($console) use($command) {
         $console->add($command);
     });
     return $command;
 }