Example #1
0
 /**
  * @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;
 }
Example #2
0
 public function test_added_before_script_is_appended_to_list()
 {
     self::assertCount(0, $this->sut->getBeforeScript());
     $this->sut->addBeforeScript($expected = 'composer self-update');
     self::assertCount(1, $this->sut->getBeforeScript());
     self::assertContains($expected, $this->sut->getBeforeScript());
     $this->sut->addBeforeScript($expected = 'composer install');
     self::assertCount(2, $this->sut->getBeforeScript());
     self::assertContains($expected, $this->sut->getBeforeScript());
 }