Пример #1
0
 /**
  * Configures container based on providen config file and profile.
  *
  * @param ContainerInterface $container
  * @param InputInterface     $input
  */
 protected function loadConfiguration(ContainerInterface $container, InputInterface $input)
 {
     $file = $input->getParameterOption(array('--config', '-c'));
     $profile = $input->getParameterOption(array('--profile', '-p')) ?: 'default';
     $cwd = getcwd();
     // if config file is not provided
     if (!$file) {
         // then use behat.yml
         if (is_file($cwd . DIRECTORY_SEPARATOR . 'behat.yml')) {
             $file = $cwd . DIRECTORY_SEPARATOR . 'behat.yml';
             // or behat.yml.dist
         } elseif (is_file($cwd . DIRECTORY_SEPARATOR . 'behat.yml.dist')) {
             $file = $cwd . DIRECTORY_SEPARATOR . 'behat.yml.dist';
             // or config/behat.yml
         } elseif (is_file($cwd . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'behat.yml')) {
             $file = $cwd . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'behat.yml';
         }
     }
     // read configuration
     $loader = new Loader($file);
     $configs = $loader->loadConfiguration($profile);
     // locate base path
     $basePath = $cwd;
     if (file_exists($file)) {
         $basePath = realpath(dirname($file));
     }
     // load core extension into temp container
     $extension = new BehatExtension($basePath);
     $extension->load($configs, $container);
     $container->addObjectResource($extension);
 }
 /**
  * Configures container based on providen config file and profile.
  *
  * @param ContainerBuilder $container
  * @param InputInterface   $input
  */
 protected function loadConfiguration(ContainerBuilder $container, InputInterface $input)
 {
     // locate paths
     $this->basePath = getcwd();
     if ($configPath = $this->getConfigurationFilePath($input)) {
         $this->basePath = realpath(dirname($configPath));
     }
     // read configuration
     $loader = new Loader($configPath);
     $profile = $input->getParameterOption(array('--profile', '-p')) ?: 'default';
     return $loader->loadConfiguration($profile);
 }