function UnpackRecipeTest::testRemoveRecipe

Tests a recipe can be removed and the unpack plugin does not interfere.

File

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

Class

UnpackRecipeTest
Tests recipe unpacking.

Namespace

Drupal\Tests\Composer\Plugin\Unpack\Functional

Code

public function testRemoveRecipe() : 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.on-require false');
    $this->runComposer('install');
    // Install a recipe and ensure it is not unpacked.
    $this->runComposer('require fixtures/recipe-a');
    $root_composer_json = $this->getFileContents($root_project_path . '/composer.json');
    $this->assertSame([
        'composer/installers',
        'drupal/core-recipe-unpack',
        'fixtures/recipe-a',
    ], array_keys($root_composer_json['require']));
    // Removing the recipe should work as normal.
    $this->runComposer('remove fixtures/recipe-a');
    $root_composer_json = $this->getFileContents($root_project_path . '/composer.json');
    $this->assertSame([
        'composer/installers',
        'drupal/core-recipe-unpack',
    ], 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.