function UnpackRecipeTest::testRecipeIsPhysicallyPresentAfterUnpack
Tests that recipes stick around after being unpacked.
File
-
core/
tests/ Drupal/ Tests/ Composer/ Plugin/ Unpack/ Functional/ UnpackRecipeTest.php, line 503
Class
- UnpackRecipeTest
- Tests recipe unpacking.
Namespace
Drupal\Tests\Composer\Plugin\Unpack\FunctionalCode
public function testRecipeIsPhysicallyPresentAfterUnpack() : void {
$root_project_dir = 'composer-root';
$root_project_path = $this->fixturesDir . '/' . $root_project_dir;
$this->runComposer('install');
// Install a recipe, which should unpack it.
$stdOut = $this->runComposer('require --verbose fixtures/recipe-b');
$this->assertStringContainsString("fixtures/recipe-b unpacked.", $stdOut);
$this->assertFileExists($root_project_path . '/recipes/recipe-b/recipe.yml');
// Require another dependency.
$this->runComposer('require --verbose fixtures/module-b');
// The recipe should still be physically installed...
$this->assertFileExists($root_project_path . '/recipes/recipe-b/recipe.yml');
// ...but it should NOT be in installed.json or installed.php.
$installed_json = $this->getFileContents($root_project_path . '/vendor/composer/installed.json');
$installed_packages = array_column($installed_json['packages'], 'name');
$this->assertContains('fixtures/module-b', $installed_packages);
$this->assertNotContains('fixtures/recipe-b', $installed_packages);
$installed_php = (include_once $root_project_path . '/vendor/composer/installed.php');
$this->assertArrayHasKey('fixtures/module-b', $installed_php['versions']);
$this->assertArrayNotHasKey('fixtures/recipe-b', $installed_php['versions']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.