Example #1
0
 /**
  * Console constructor.
  *
  * @param string $appNamespace Application namespace (autodetect, if empty)
  * @param array  $values       Default options
  * @param array  $fixPaths     Path fixes
  *
  * @return Console
  */
 public function __construct($appNamespace = '', array $values = [], array $fixPaths = [])
 {
     parent::__construct($appNamespace, $values, $fixPaths);
     $this->commandPath = isset($fixPaths['commandDir']) ? $fixPaths['commandDir'] : Utils::fixPath($this->getRootDir() . '/src/Command/');
     $this->loadCommands($this->getCommandPath());
     // load Propel commands
     if ($this['minion.usePropel']) {
         $this->loadCommands(Utils::fixPath(($this['environment'] === 'test' ? $this->getRootDir() . '/../' : $this->getRootDir()) . '/vendor/propel/propel/src/Propel/Generator/Command/'), 'propel');
         // replace default config-dir value command option
         /** @var Command $command */
         foreach ($this['console']->all('propel') as $command) {
             $def = $command->getDefinition();
             $old = $def->getOptions();
             foreach ($old as $i => $o) {
                 if ($o->getName() === 'config-dir') {
                     unset($old[$i]);
                     break;
                 }
             }
             $opt = new InputOption('config-dir', null, InputOption::VALUE_REQUIRED, 'The directory where the configuration file is placed.', $this->getPackageDir());
             $def->setOptions(\array_merge($old, [$opt]));
         }
     }
 }
Example #2
0
 /**
  * Run application without error handlers to simplify error output (instead of HTML error page).
  *
  * @param Application $app
  * @param Request     $request
  *
  * @return Response Request response
  */
 private function commonRunRaw(Application $app, Request $request)
 {
     $response = $app->handle($request, HttpKernelInterface::MASTER_REQUEST, false);
     $app->terminate($request, $response);
     return $response;
 }
Example #3
0
 /**
  * Test namespace detection.
  *
  * @return void
  */
 public function testNamespaceDetection()
 {
     $this->commonSetPaths();
     $minion = new Application('', ['debug' => true, 'environment' => 'test'], ['rootDir' => $this->fixedRootDir, 'packageDir' => $this->fixedPackageDir]);
     $this->assertEquals('Minion\\Tests\\', $minion->getAppNamespace());
 }