public function test_loop_until_valid_answer_on_which_php_versions_to_build() { $this->questionHelper->method('ask')->willReturnOnConsecutiveCalls('6.0', 'asdf', '7.0', null); $actual = $this->sut->askWhichPhpVersionsToBuild($this->input, $this->output, ['7.0', '5.6', '5.5']); self::assertInternalType('array', $actual); self::assertContains('7.0', $actual); }
/** * @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; }