Esempio n. 1
0
 protected function setUp()
 {
     $this->oldApplicationContext = ApplicationContext::getInstance();
     $this->applicationContext = $this->createApplicationContext();
     $this->applicationContext->setPlugin($this->getPlugin());
     $this->applicationContext->setComponent('input', new ArgvInput());
     $output = new ConsoleOutput();
     $output->setDecorated(false);
     $this->applicationContext->setComponent('output', $output);
     ApplicationContext::setInstance($this->applicationContext);
 }
Esempio n. 2
0
 public function __construct()
 {
     $this->setGlobalInput();
     $this->consoleOutput = new ConsoleOutput();
     if ($this->globalInput->hasParameterOption(array('--ansi'))) {
         $this->consoleOutput->setDecorated(true);
     } elseif ($this->globalInput->hasParameterOption(array('--no-ansi'))) {
         $this->consoleOutput->setDecorated(false);
     }
     parent::__construct(self::NAME, self::VERSION);
     $dispatcher = new EventDispatcher();
     $dispatcher->addListener(ConsoleEvents::COMMAND, array($this, 'onCommand'));
     $this->setDispatcher($dispatcher);
     $this->loadConfig();
     $this->addCoreCommands();
     // start output buffering to intercept show_error calls
     ob_start();
     register_shutdown_function(array($this, 'shutdown'));
 }
Esempio n. 3
0
 public function terminate($request, $response)
 {
     $output = new ConsoleOutput();
     $output->setDecorated(true);
     $output->writeln('<fg=green>REQUEST:</> ' . '<fg=yellow>Method: ' . $request->method() . '</>; ' . '<fg=yellow>Ajax: ' . $request->ajax() . '</>; ' . '<fg=yellow>Input: ' . json_encode($request->all()) . '</>');
 }