public function run() { if (!$this->autotest) { $this->testRunFactory->create()->run(); } else { $autotest = $this->autotestFactory->create(); $autotest->runTests(); $autotest->monitorAlteration(); } }
/** * Runs tests. * * @since Method available since Release 2.1.0 */ public function run() { $this->outputBuffering->clearOutputHandlers(); $this->preparerFactory->create()->prepare(); $runner = $this->runnerFactory->create(); $this->result = $runner->run($this->collectorFactory->create()->collect()); if ($runner->shouldNotify()) { $this->notifierFactory->create()->notifyResult($runner->getNotification()); } }
/** * @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; }