/**
  * @param InputDefinition $inputDefinition
  * @param InputInterface  $input
  * @param string          $expectedCommandLine
  * @param array           $skipOptions
  *
  * @see          ScenarioProcessFactory::init
  * @see          ScenarioProcessFactory::make
  *
  * @dataProvider providerMake
  */
 public function testMake(InputDefinition $inputDefinition, InputInterface $input, $expectedCommandLine = '', array $skipOptions = [])
 {
     $scenarioProcessFactory = new ScenarioProcessFactory('bin/behat');
     $scenarioProcessFactory->addSkipOptions($skipOptions);
     $scenarioProcessFactory->init($inputDefinition, $input);
     $scenarioInfo = new ScenarioInfo('file', 1);
     $process = $scenarioProcessFactory->make($scenarioInfo);
     $this->assertEquals(trim(sprintf('%s bin/behat \'file:1\' %s', PHP_BINARY, $expectedCommandLine)), $process->getCommandLine());
 }
 /**
  * {@inheritdoc}
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $result = null;
     $maxProcessesAmount = max(1, $input->getOption(self::OPTION_PARALLEL_PROCESS));
     $locator = $input->getArgument('paths');
     if ($maxProcessesAmount > 1) {
         $this->outputPrinter->init($output);
         $this->processFactory->init($this->inputDefinition, $input);
         $this->featureRunner->setMaxParallelProcess($maxProcessesAmount);
         $result = 0;
         foreach ($this->featureExtractor->extract($locator) as $featureNode) {
             $result = max($result, $this->featureRunner->run($featureNode));
         }
     }
     return $result;
 }
 /**
  * @param ScenarioInfo[] $scenarios
  *
  * @return int
  */
 protected function runScenarios(array $scenarios)
 {
     $result = 0;
     /** @var ScenarioProcess[] $processes */
     $processes = array_map(function (ScenarioInfo $scenarioInfo) {
         return $this->scenarioProcessFactory->make($scenarioInfo);
     }, $scenarios);
     $this->parallelProcessRunner->reset()->add($processes)->run();
     foreach ($processes as $process) {
         $result = max($result, $process->getExitCode());
     }
     return $result;
 }