/**
  * @param string $command
  *
  * @return array
  */
 protected function buildOptions($command)
 {
     $options = array();
     if (basename(trim($command, '\'"')) != 'testrunner') {
         $configFile = $this->getPHPConfigDir();
         if ($configFile !== false) {
             $options[] = '-c';
             $options[] = escapeshellarg($configFile);
         }
         $options[] = escapeshellarg($_SERVER['argv'][0]);
     }
     if ($this->terminal->shouldColor()) {
         $options[] = '--ansi';
     }
     $options[] = escapeshellarg(strtolower($this->plugin->getPluginID()));
     if (!is_null($this->environment->getPreloadScript())) {
         $options[] = '-p ' . escapeshellarg($this->environment->getPreloadScript());
     }
     $options[] = '-R';
     if ($this->runner->shouldNotify()) {
         $options[] = '-m';
     }
     if ($this->runner->shouldStopOnFailure()) {
         $options[] = '--stop-on-failure';
     }
     if (!$this->testTargetRepository->isDefaultFilePattern()) {
         $options[] = '--test-file-pattern=' . escapeshellarg($this->testTargetRepository->getFilePattern());
     }
     if ($this->runner->hasDetailedProgress()) {
         $options[] = '--detailed-progress';
     }
     if (!is_null($this->commandLineOptionBuilder)) {
         $options = $this->commandLineOptionBuilder->build($options);
     }
     $this->testTargetRepository->walkOnResources(function ($resource, $index, TestTargetRepository $testTargetRepository) use(&$options) {
         $options[] = escapeshellarg($resource);
     });
     return $options;
 }
Example #2
0
 /**
  * @return array
  */
 protected function buildRunnerOptions()
 {
     $options = array();
     if (basename(trim($this->runnerCommand, '\'"')) != 'testrunner') {
         $configFile = $this->getPHPConfigDir();
         if ($configFile !== false) {
             $options[] = '-c';
             $options[] = escapeshellarg($configFile);
         }
         $options[] = escapeshellarg($_SERVER['argv'][0]);
     }
     if ($this->terminal->shouldColor()) {
         $options[] = '--ansi';
     }
     $options[] = escapeshellarg(strtolower(ApplicationContext::getInstance()->getPlugin()->getPluginID()));
     if (!is_null(ApplicationContext::getInstance()->getEnvironment()->getPreloadScript())) {
         $options[] = '-p ' . escapeshellarg(ApplicationContext::getInstance()->getEnvironment()->getPreloadScript());
     }
     $options[] = '-R';
     if ($this->runnerFactory->create()->shouldNotify()) {
         $options[] = '-m';
     }
     if ($this->runnerFactory->create()->shouldStopOnFailure()) {
         $options[] = '--stop-on-failure';
     }
     if (!$this->testTargetRepository->isDefaultFilePattern()) {
         $options[] = '--test-file-pattern=' . escapeshellarg($this->testTargetRepository->getFilePattern());
     }
     if ($this->runnerFactory->create()->hasDetailedProgress()) {
         $options[] = '--detailed-progress';
     }
     $options = array_merge($options, $this->doBuildRunnerOptions());
     $this->testTargetRepository->walkOnResources(function ($resource, $index, TestTargetRepository $testTargetRepository) use(&$options) {
         $options[] = escapeshellarg($resource);
     });
     return $options;
 }