function UnpackRecipeTest::testNoAutomaticDevUnpack
Tests the dev dependencies do not unpack on install.
File
-
core/
tests/ Drupal/ Tests/ Composer/ Plugin/ Unpack/ Functional/ UnpackRecipeTest.php, line 144
Class
- UnpackRecipeTest
- Tests recipe unpacking.
Namespace
Drupal\Tests\Composer\Plugin\Unpack\FunctionalCode
public function testNoAutomaticDevUnpack() : void {
$root_project_path = $this->fixturesDir . '/composer-root';
// Run composer install and confirm the composer.lock was created.
$this->runComposer('install');
// Install a module in require.
$this->runComposer('require fixtures/module-a');
$root_composer_json = $this->getFileContents($root_project_path . '/composer.json');
$this->assertArrayHasKey('fixtures/module-a', $root_composer_json['require']);
// Install a recipe as a dev dependency.
$stdout = $this->runComposer('require --dev fixtures/recipe-a');
$this->assertStringContainsString("Recipes required as a development dependency are not automatically unpacked.", $stdout);
$root_composer_json = $this->getFileContents($root_project_path . '/composer.json');
// Assert the state of the root composer.json as no unpacking has occurred.
$this->assertSame([
'fixtures/recipe-a',
], array_keys($root_composer_json['require-dev']));
$this->assertSame([
'composer/installers',
'drupal/core-recipe-unpack',
'fixtures/module-a',
], 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.