/** * {@inheritdoc} * * Configures Peridot based on user input. * * @param InputInterface $input * @param OutputInterface $output */ protected function initialize(InputInterface $input, OutputInterface $output) { $this->eventEmitter->emit('peridot.load', $this); $this->getRunner()->setStopOnFailure($input->getOption('bail')); $reporter = $input->getOption('reporter') ?: 'spec'; $reporter = $this->factory->create($reporter); $reporter->setColorsEnabled(!$input->getOption('no-colors')); $grep = $input->getOption('grep') ?: '*.spec.php'; $this->getLoader()->setPattern($grep); }
/** * Return the result as an integer. * * @return int */ protected function getResult() { $result = new TestResult($this->eventEmitter); $this->getLoader()->load($this->configuration->getPath()); $this->factory->create($this->configuration->getReporter()); $this->runner->run($result); if ($result->getFailureCount() > 0) { return 1; } return 0; }