function UnpackRecipeTest::testIgnoreDependentRecipe

Tests a dependent recipe can be ignored and not unpacked.

File

core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php, line 474

Class

UnpackRecipeTest
Tests recipe unpacking.

Namespace

Drupal\Tests\Composer\Plugin\Unpack\Functional

Code

public function testIgnoreDependentRecipe() : void {
    $root_project_path = $this->fixturesDir . '/composer-root';
    // Disable automatic unpacking, which is the default behavior,
    $this->runComposer('config --merge --json extra.drupal-recipe-unpack.ignore \'["fixtures/recipe-b"]\'');
    $this->runComposer('config sort-packages true');
    $this->runComposer('install');
    // Install a recipe and check it is not packed but not removed.
    $stdOut = $this->runComposer('require --verbose fixtures/recipe-a');
    $root_composer_json = $this->getFileContents($root_project_path . '/composer.json');
    $this->assertStringContainsString("fixtures/recipe-b not unpacked because it is ignored.", $stdOut);
    $this->assertStringContainsString("fixtures/recipe-a unpacked.", $stdOut);
    $this->assertSame([
        'composer/installers',
        'drupal/core-recipe-unpack',
        'fixtures/module-b',
        'fixtures/recipe-b',
    ], array_keys($root_composer_json['require']));
    // Ensure the resulting Composer files are valid.
    $this->runComposer('validate');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.