You are here

class BuilderTest in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Composer/Generator/BuilderTest.php \Drupal\Tests\Composer\Generator\BuilderTest
  2. 9 core/tests/Drupal/Tests/Composer/Generator/BuilderTest.php \Drupal\Tests\Composer\Generator\BuilderTest

Test DrupalCoreRecommendedBuilder.

@group Metapackage

Hierarchy

  • class \Drupal\Tests\Composer\Generator\BuilderTest extends \PHPUnit\Framework\TestCase

Expanded class hierarchy of BuilderTest

File

core/tests/Drupal/Tests/Composer/Generator/BuilderTest.php, line 16

Namespace

Drupal\Tests\Composer\Generator
View source
class BuilderTest extends TestCase {

  /**
   * Provides test data for testBuilder.
   */
  public function builderTestData() {
    return [
      [
        DrupalCoreRecommendedBuilder::class,
        [
          'name' => 'drupal/core-recommended',
          'type' => 'metapackage',
          'description' => 'Core and its dependencies with known-compatible minor versions. Require this project INSTEAD OF drupal/core.',
          'license' => 'GPL-2.0-or-later',
          'require' => [
            'drupal/core' => Composer::drupalVersionBranch(),
            'symfony/polyfill-ctype' => '~v1.12.0',
            'symfony/yaml' => '~v3.4.32',
          ],
          'conflict' => [
            'webflo/drupal-core-strict' => '*',
          ],
        ],
      ],
      [
        DrupalDevDependenciesBuilder::class,
        [
          'name' => 'drupal/core-dev',
          'type' => 'metapackage',
          'description' => 'require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.',
          'license' => 'GPL-2.0-or-later',
          'require' => [
            'behat/mink' => '^1.8',
          ],
          'conflict' => [
            'webflo/drupal-core-require-dev' => '*',
          ],
        ],
      ],
      [
        DrupalPinnedDevDependenciesBuilder::class,
        [
          'name' => 'drupal/core-dev-pinned',
          'type' => 'metapackage',
          'description' => 'Pinned require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.',
          'license' => 'GPL-2.0-or-later',
          'require' => [
            'drupal/core' => Composer::drupalVersionBranch(),
            'behat/mink' => 'v1.8.0',
            'symfony/css-selector' => 'v4.3.5',
          ],
          'conflict' => [
            'webflo/drupal-core-require-dev' => '*',
          ],
        ],
      ],
    ];
  }

  /**
   * Tests all of the various kinds of builders.
   *
   * @dataProvider builderTestData
   */
  public function testBuilder($builderClass, $expected) {
    $fixtures = new Fixtures();
    $drupalCoreInfo = $fixtures
      ->drupalCoreComposerFixture();
    $builder = new $builderClass($drupalCoreInfo);
    $generatedJson = $builder
      ->getPackage();
    $this
      ->assertEquals($expected, $generatedJson);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BuilderTest::builderTestData public function Provides test data for testBuilder.
BuilderTest::testBuilder public function Tests all of the various kinds of builders.