コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: CommandTest.php プロジェクト: viserio/console
 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());
 }
コード例 #3
0
ファイル: ApplicationTest.php プロジェクト: viserio/console
 /**
  * @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);
 }
コード例 #4
0
ファイル: Kernel.php プロジェクト: narrowspark/framework
 /**
  * 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;
 }