/** * Run the Peridot application * * @param InputInterface $input * @param OutputInterface $output * @return int */ public function doRun(InputInterface $input, OutputInterface $output) { $this->configuration = ConfigurationReader::readInput($input); $this->environment->getEventEmitter()->emit('peridot.configure', [$this->configuration, $this]); $runner = $this->getRunner(); $factory = new ReporterFactory($this->configuration, $output, $this->environment->getEventEmitter()); $this->loadDsl($this->configuration->getDsl()); $this->add(new Command($runner, $this->configuration, $factory, $this->environment->getEventEmitter())); $exitCode = parent::doRun($input, $output); $this->environment->getEventEmitter()->emit('peridot.end', [$exitCode, $input, $output]); return $exitCode; }
assert($config->getGrep() == "mygrep", "grep should be mygrep"); assert(!$config->areColorsEnabled(), "colors should be disabled"); assert($config->shouldStopOnFailure(), "should stop on failure"); assert($config->getConfigurationFile() == __FILE__, "config should be current file"); }; }); describe("->read()", function () { it("should return configuration from InputInterface", function () { $reader = new ConfigurationReader($this->input); $config = $reader->read(); call_user_func($this->assert, $config); }); it("should throw an exception if configuration is specified but does not exist", function () { $this->definition['--configuration'] = '/path/to/nope.php'; $input = new ArrayInput($this->definition, new InputDefinition()); $reader = new ConfigurationReader($input); $exception = null; try { $reader->read(); } catch (\RuntimeException $e) { $exception = $e; } assert(!is_null($exception), "exception should not be null"); }); }); describe('::readInput()', function () { it('should read input', function () { $config = ConfigurationReader::readInput($this->input); call_user_func($this->assert, $config); }); });