function ComponentsTaggedReleaseTest::testReleaseTagging
Same name in other branches
- 9 core/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.php \Drupal\BuildTests\Composer\Component\ComponentsTaggedReleaseTest::testReleaseTagging()
- 10 core/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.php \Drupal\BuildTests\Composer\Component\ComponentsTaggedReleaseTest::testReleaseTagging()
Validate release tagging and regeneration of dependencies.
@dataProvider providerVersionConstraint
File
-
core/
tests/ Drupal/ BuildTests/ Composer/ Component/ ComponentsTaggedReleaseTest.php, line 44
Class
- ComponentsTaggedReleaseTest
- Demonstrate that the Component generator responds to release tagging.
Namespace
Drupal\BuildTests\Composer\ComponentCode
public function testReleaseTagging(string $tag, string $constraint) : void {
$this->copyCodebase();
$drupal_root = $this->getWorkspaceDirectory();
// Set the core version.
Composer::setDrupalVersion($drupal_root, $tag);
$this->assertDrupalVersion($tag, $drupal_root);
// Emulate the release script.
// @see https://github.com/xjm/drupal_core_release/blob/main/tag.sh
$this->executeCommand("COMPOSER_ROOT_VERSION=\"{$tag}\" composer update drupal/core*");
$this->assertCommandSuccessful();
$this->assertErrorOutputContains('generateComponentPackages');
// Find all the components.
$component_finder = $this->getComponentPathsFinder($drupal_root);
// Loop through all the component packages.
/** @var \Symfony\Component\Finder\SplFileInfo $composer_json */
foreach ($component_finder->getIterator() as $composer_json) {
$composer_json_data = json_decode(file_get_contents($composer_json->getPathname()), TRUE);
$requires = array_merge($composer_json_data['require'] ?? [], $composer_json_data['require-dev'] ?? []);
// Required packages from drupal/core-* should have our constraint.
foreach ($requires as $package => $req_constraint) {
if (str_contains($package, 'drupal/core-')) {
$this->assertEquals($constraint, $req_constraint);
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.