From 6f9e03f238403b53c04f26a24dd8777f62135213 Mon Sep 17 00:00:00 2001 From: Nikolay Shapovalov Date: Thu, 7 Dec 2023 23:56:20 +0600 Subject: [PATCH] Support Drupal core 11 (#27) * Update README.md * Update PackageRequiresAdjuster.php * Update PackageRequiresAdjusterTest.php --- README.md | 2 +- src/PackageRequiresAdjuster.php | 2 +- tests/PackageRequiresAdjusterTest.php | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9756e14..22ce383 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ See [Add a composer plugin that supports 'composer require-lenient' to support m This subscribes to `PluginEvents::PRE_POOL_CREATE` and filters packages. This is inspired by `symfony/flex`, but it does not filter out packages. It rewrites the `drupal/core` constraint on any package with a type of `drupal-*`, -excluding `drupal-core`. The constraint is set to `'^8 || ^9 || ^10'` for `drupal/core`. +excluding `drupal-core`. The constraint is set to `'^8 || ^9 || ^10 || ^11'` for `drupal/core`. ## Try it diff --git a/src/PackageRequiresAdjuster.php b/src/PackageRequiresAdjuster.php index a007c96..602fc4f 100644 --- a/src/PackageRequiresAdjuster.php +++ b/src/PackageRequiresAdjuster.php @@ -22,7 +22,7 @@ public function __construct( private readonly Composer $composer ) { $this->drupalCoreConstraint = (new VersionParser()) - ->parseConstraints('^8 || ^9 || ^10'); + ->parseConstraints('^8 || ^9 || ^10 || ^11'); } public function applies(PackageInterface $package): bool diff --git a/tests/PackageRequiresAdjusterTest.php b/tests/PackageRequiresAdjusterTest.php index f6567e1..e33faf2 100644 --- a/tests/PackageRequiresAdjusterTest.php +++ b/tests/PackageRequiresAdjusterTest.php @@ -86,6 +86,7 @@ public function testAdjust(?string $coreVersion, string $expectedCoreConstraintS $originalDrupalCoreConstraint = new MultiConstraint([ new Constraint('>=', '8.0'), new Constraint('>=', '9.0'), + new Constraint('>=', '10.0'), ]); $originalTokenConstraint = new Constraint('>=', '1.10.0'); $package = new CompletePackage('foo', '1.0', '1.0'); @@ -128,8 +129,8 @@ public function testAdjust(?string $coreVersion, string $expectedCoreConstraintS public function provideAdjustData(): array { return [ - [null, '^8 || ^9 || ^10'], - ['10.0.0-alpha5', '^8 || ^9 || ^10'], + [null, '^8 || ^9 || ^10 || ^11'], + ['10.0.0-alpha5', '^8 || ^9 || ^10 || ^11'], ]; } }