Ejemplo n.º 1
0
 /**
  * @see     Behat\Behat\Console\Configuration\ProcessorInterface::process()
  */
 public function process(ContainerInterface $container, InputInterface $input, OutputInterface $output)
 {
     $extension = new BehatExtension();
     $cwd = getcwd();
     $configFile = $input->getOption('config');
     $profile = $input->getOption('profile') ?: 'default';
     $configs = array();
     if (null === $configFile) {
         if (is_file($cwd . DIRECTORY_SEPARATOR . 'behat.yml')) {
             $configFile = $cwd . DIRECTORY_SEPARATOR . 'behat.yml';
         } elseif (is_file($cwd . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'behat.yml')) {
             $configFile = $cwd . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'behat.yml';
         }
     }
     // read and normalize raw parameters string from env
     if ($config = getenv('BEHAT_PARAMS')) {
         parse_str($config, $config);
         $configs[] = $this->normalizeRawConfiguration($config);
     }
     // read configuration file
     if (file_exists($configFile)) {
         $configs[] = $extension->readConfigurationFile($configFile, $profile, $container);
     }
     // configure container
     $extension->load($configs, $container);
     $container->addCompilerPass(new GherkinPass());
     $container->addCompilerPass(new ContextReaderPass());
     $container->addCompilerPass(new EventDispatcherPass());
     $container->compile();
     if (file_exists($configFile)) {
         $container->get('behat.path_locator')->setPathConstant('BEHAT_CONFIG_PATH', dirname($configFile));
     }
 }