/** * @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_can_allow_failures_to_yml() { $config = new Config('php'); $config->getMatrix()->setAllowFailures('php', ['7.0', '5.6']); $actual = $this->sut->toYml($config); self::assertEquals(<<<YML language: php matrix: allow_failures: - { php: '7.0' } - { php: '5.6' } YML , $actual); }
public function test_can_set_matrix() { self::assertInstanceOf(Matrix::class, $this->sut->getMatrix()); $this->sut->setMatrix($expected = new Matrix()); self::assertSame($expected, $this->sut->getMatrix()); }