jhedstrom / drupalextension

An integration layer between Behat, Mink Extension, and Drupal.
GNU General Public License v2.0
209 stars 192 forks source link

Error when tried to update to 5.0.0 alpha, conflicts with drupal/core-dev #637

Open Eduardo-Morales-Alberti opened 1 year ago

Eduardo-Morales-Alberti commented 1 year ago

Problem

Could not update to 5.0.0 alpha because of conflicts with drupal/core-dev. I required the 5.0.0 alpha because I need to remove the goutte-drive requirement to use Guzzle 7 fixed on commit https://github.com/jhedstrom/drupalextension/commit/2ab66a7eae53ae4e1e5824edaa72e98039b084db

Possible Solution

I am not sure if this is the problem, drupalextension and core-dev require the same projects different repositories: https://github.com/jhedstrom/drupalextension/blob/v5.0.0alpha1/composer.json#L27

  "require": {
...
    "behat/mink-browserkit-driver": "^2.1.0",
...

https://github.com/drupal/core-dev/blob/9.5.3/composer.json#L15

    "require": {
...
        "friends-of-behat/mink-browserkit-driver": "^1.4",
...

Error:

wodby@php.container:/var/www/html $ composer require "drupal/drupal-extension:v5.0.0alpha1 as v4.3.1" drupal/core-dev:~9.5.3 friends-of-behat/mink-browserkit-driver:^1.6.1  -W --dev
./composer.json has been updated
Running composer update drupal/drupal-extension drupal/core-dev friends-of-behat/mink-browserkit-driver --with-all-dependencies
Gathering patches for root package.
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires drupal/drupal-extension v5.0.0alpha1 as v4.3.1 -> satisfiable by drupal/drupal-extension[v5.0.0alpha1].
    - Only one of these can be installed: behat/mink-browserkit-driver[v2.1.0, 2.x-dev], friends-of-behat/mink-browserkit-driver[v1.6.1]. friends-of-behat/mink-browserkit-driver replaces behat/mink-browserkit-driver and thus cannot coexist with it.
    - drupal/drupal-extension v5.0.0alpha1 requires behat/mink-browserkit-driver ^2.1.0 -> satisfiable by behat/mink-browserkit-driver[v2.1.0, 2.x-dev].
    - Root composer.json requires friends-of-behat/mink-browserkit-driver ^1.6.1 -> satisfiable by friends-of-behat/mink-browserkit-driver[v1.6.1].
Berdir commented 1 year ago

Your proposed change would instead conflict with D10: https://github.com/drupal/core-dev/blob/10.0.x/composer.json.

Do you really need drupal/core-dev? Are you running phpunit browser tests in the same environment? If not, you could drop the core-dev dependency and only require what you actually need.

jhedstrom commented 1 year ago

Hmm, it is fairly common I think to run phpunit tests (based on core's base classes) in the same environments as Behat, so ideally we'd fix this conflict with drupal/core-dev...

Berdir commented 1 year ago

We could be compatible with two different versions of the same package, but we're talking about two different packages here, I don't think that's possible.

You can still explicitly require phpunit and other dependencies, just not the drupal/core-dev wrapper.

Eduardo-Morales-Alberti commented 1 year ago

I think friends-of-behat/mink-browserkit-driver was forked to be compatible with PHP 8 and higher versions of Symfony, it could be deprecated, and should be changed on core-dev. Maybe this is not the place.

Eduardo-Morales-Alberti commented 1 year ago

Created PR on core-dev https://github.com/drupal/core-dev/pull/4/files, sorry for the noise.

jhedstrom commented 1 year ago

It looks like from the comment on that PR you'll need to open an issue on drupal.org since the github repo is auto-generated.

Berdir commented 1 year ago

Core isn't going to change this, it will not introduce possibly breaking changes in Drupal 9. The main point of drupal/core-dev is to be able to reliable run the same phpunit tests that core (and contrib) contains.

If you can't update to D10 yet then the only option is to not require drupal/core-dev but rely on the desired dependencies and versions directly. Might be worth mentioning this in the readme/release notes of 5.x

jhedstrom commented 1 year ago

If the friends-of-behat one is truly deprecated, wouldn't core update to the non-deprecated one? I'm having trouble finding documentation about the deprecations or preferred package though. This https://github.com/minkphp/MinkBrowserKitDriver seems more active than the friends one...

Berdir commented 1 year ago

if the friends-of-behat one is truly deprecated, wouldn't core update to the non-deprecated one?

That's exactly what core did, but only in D10, as it was apparently considered a BC breaking change or maybe just not important enough. I wasn't involved in the issue and don't know the exact reason. But I can guarantee you that this will not be changed in a 9.5 patch release, so we just have to live with it.

jhedstrom commented 1 year ago

ah, ok, I misunderstood.

Eduardo-Morales-Alberti commented 1 year ago

Created issue on core https://www.drupal.org/project/drupal/issues/3343911

AlexSkrypnyk commented 1 year ago

I'd like to summarise the above (after gathering information from the multiple sources):

  1. Drupal Extension v5 is currently compatible with D9 and is tested to be compatible (in CI).

  2. However, due to the issue described here it is not installable if the consumer site uses drupal/core-dev metapackage

  3. Currently, CI for Drupal Extension does not use drupal/core-dev, which "masks" this problem.

  4. @Berdir and @catch have discussed this on Slack and per @berdir's comment in Slack:

    Note that the mentioned incompatibility is with behat Drupal extension 5.x alpha. Committing this would in turn then cause the opposite conflict with the stable 4.x releases.

  5. It is now not clear what the intention of Drupal Extension to support D9 - supporting only sites that do not use drupal/core-dev is not a feasible option (https://github.com/drupal-composer/drupal-project prescribes it as a best practice).

@Berdir Can we mark friends-of-behat/mink-browserkit-driver (or whatever the conflict is) as a conflict for 9.5.x branch and action the change for 9.6.x branch (so that at least next minor D9 would support v5). The patch in https://www.drupal.org/project/drupal/issues/3343911 has passed CI, so technically it looks like it is stable. I'm wondering if more considerations could be given by the core team.

Berdir commented 1 year ago

There is no next minor Drupal 9 version, Drupal 9 is EOL in December. Either stick to using 3.x on Drupal 9 or don't use drupal/core-dev. And the medium/long-term fix that you have to do anyway this year is upgrading to Drupal 10.