private function doRunAll() { $command = $this->cmdRunAll; if ($this->options['keep_failed']) { $files = array(); foreach ($this->failed as $key => $failedEvent) { $file = $failedEvent->getArgument('file'); if (file_exists($file)) { $file = ltrim(str_replace(getcwd(), '', $file), '\\/'); if (!in_array($file, $files)) { $files[] = $file; } } } $files = array_unique($files); if (!empty($files)) { $command = $this->cmdRun; $specFiles = implode(',', $files); $command = $command . ' --spec-files=' . $specFiles; $this->logger->debug('Keep failed spec run'); } } // start to run phpspec command $arguments = explode(' ', $command); $builder = new ProcessBuilder($arguments); $runner = $this->getRunner(); $runner->run($builder); // not showing success events for run all $results = $this->renderResult(false); if (count($this->failed) === 0) { $results[] = ResultEvent::createSucceed('Run all specs success'); } return $results; }
/** * @param string $file * @return string */ private function matchFile($file) { $tags = $this->container->getParameter('filter.tags', array()); /* @var Watcher $watcher */ foreach ($this->watchers as $watcher) { if (false === $watcher->hasTags($tags)) { $options = $watcher->getOptions(); $this->logger->debug('Unmatched tags', array('watcher.tags' => $options['tags'], 'app.tags' => $tags)); continue; } if ($matched = $watcher->matchFile($file)) { if (true === ($output = $watcher->lint($file))) { return $matched; } else { $this->renderLintOutput($output); } } } return false; }