protected function ComposerProjectTemplatesTest::getLowestDependencyStability in Drupal 9
Returns the stability of the least stable dependency.
1 call to ComposerProjectTemplatesTest::getLowestDependencyStability()
- ComposerProjectTemplatesTest::testMinimumStabilityStrictness in core/
tests/ Drupal/ BuildTests/ Composer/ Template/ ComposerProjectTemplatesTest.php - Make sure that static::MINIMUM_STABILITY is sufficiently strict.
File
- core/
tests/ Drupal/ BuildTests/ Composer/ Template/ ComposerProjectTemplatesTest.php, line 359
Class
- ComposerProjectTemplatesTest
- Demonstrate that Composer project templates are buildable as patched.
Namespace
Drupal\BuildTests\Composer\TemplateCode
protected function getLowestDependencyStability() {
$root = $this
->getDrupalRoot();
$process = $this
->executeCommand("composer --working-dir={$root} info --format=json");
$this
->assertCommandSuccessful();
$installed = json_decode($process
->getOutput(), TRUE);
$lowest_stability_order_index = count(static::STABILITY_ORDER);
foreach ($installed['installed'] as $project) {
// Exclude dependencies that are required with "self.version", since
// those stabilities will automatically match the corresponding Drupal
// release.
$exclude = [
'drupal/core',
'drupal/core-project-message',
'drupal/core-vendor-hardening',
];
if (!in_array($project['name'], $exclude, TRUE)) {
$stability = VersionParser::parseStability($project['version']);
$stability_order_index = array_search($stability, static::STABILITY_ORDER);
$lowest_stability_order_index = min($lowest_stability_order_index, $stability_order_index);
}
}
$lowest_stability = static::STABILITY_ORDER[$lowest_stability_order_index];
return $lowest_stability;
}