/** * @param InputInterface $input * @param OutputInterface $output * @return Config * @throws \Symfony\Component\Console\Exception\InvalidArgumentException * @throws \Symfony\Component\Console\Exception\RuntimeException */ public function createConfig(InputInterface $input, OutputInterface $output) { $config = new Config('php'); // Configure the PHP versions to build. $versions = $this->questionHelper->askWhichPhpVersionsToBuild($input, $output, self::$allowedPhpVersions); if (is_array($versions)) { $config->setPhp($versions); // Configure the builds that are allowed to fail for particular PHP versions. $allowedToFail = $this->questionHelper->askWhichBuildsAreAllowedToFail($input, $output, $versions); if (is_array($allowedToFail)) { $config->getMatrix()->setAllowFailures('php', $allowedToFail); } } // Configure installation of dependencies via Composer, and Composer self-update. $composerInstall = $this->questionHelper->confirmComposerInstall($input, $output); if ($composerInstall) { $composerSelfUpdate = $this->questionHelper->confirmComposerSelfUpdate($input, $output); if ($composerSelfUpdate) { $config->addBeforeScript('composer self-update'); } $config->addBeforeScript('composer install --no-interaction'); } // Configure execution of PHPUnit. if ($this->packageHelper->hasPackage('phpunit/phpunit', null, $input, $output) && $this->questionHelper->confirmRunPhpUnit($input, $output)) { // TODO Get bin filename from package helper. $config->addScript('vendor/bin/phpunit --coverage-text'); } // Configure execution of Behat. if ($this->packageHelper->hasPackage('behat/behat', null, $input, $output) && $this->questionHelper->confirmRunBehat($input, $output)) { // TODO Get bin filename from package helper. $config->addScript('vendor/bin/behat'); } return $config; }
public function test_added_scripts_are_appended_to_list() { self::assertCount(0, $this->sut->getScript()); $this->sut->addScript($expected = 'vendor/bin/phpunit'); self::assertCount(1, $this->sut->getScript()); self::assertContains($expected, $this->sut->getScript()); $this->sut->addScript($expected = 'vendor/bin/behat'); self::assertCount(2, $this->sut->getScript()); self::assertContains($expected, $this->sut->getScript()); }