Exemplo n.º 1
0
 public function test_duplicate_php_version_are_ignored()
 {
     self::assertCount(0, $this->sut->getPhp());
     $this->sut->setPhp([$expected = '7.0']);
     self::assertCount(1, $this->sut->getPhp());
     self::assertContains($expected, $this->sut->getPhp());
     $this->sut->addPhp($expected);
     self::assertCount(1, $this->sut->getPhp());
     self::assertContains($expected, $this->sut->getPhp());
 }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
0
    public function test_can_write_php_versions_to_yml()
    {
        $config = new Config('php');
        $config->setPhp(['7.0', '5.6']);
        $actual = $this->sut->toYml($config);
        self::assertEquals(<<<YML
language: php
php:
    - '7.0'
    - '5.6'

YML
, $actual);
    }