Drupal 10 Compatibility

Created on 26 May 2023, over 1 year ago
Updated 20 November 2023, 12 months ago

Problem/Motivation

Steps to reproduce

Proposed resolution

Use upgrade_status module to identify changes. Make this module D10 compatible. Create patch.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States rsnyd

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @rsnyd
  • 🇺🇸United States rsnyd
  • @c_archer opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇬🇧United Kingdom c_archer Cumbria
  • Status changed to Needs work over 1 year ago
  • 🇮🇱Israel jsacksick

    So, this patch is not really correct as it should also drop D8 compatibility.

    Symfony\Contracts\EventDispatcher\Event; doesn't exist on D8 since it's provided by the symfony/event-dispatcher-contracts package with is a dependency starting Drupal 9. So this patch should drop D8 compatibility.
    After this, 📌 Update core_version_requirement in .info file. Closed: duplicate can probably marked as a duplicate.

    Also you might want instead to use the bridge event class provided by Drupal core (See https://www.drupal.org/node/3159012 → for explanations).

  • 🇮🇱Israel jsacksick

    Also, I'm pretty sure the tests themselves have to be updated to run on D10.

  • 🇺🇸United States rsnyd

    @jsacksick,
    Thank you for the helpful feedback. So I've changed the .info.yml file to drop the D8 compatability. ShipStationOrderExportedEvent now uses Drupal\Component\EventDispatcher\Event.

    These two changes are included in the patch.

    As for the tests, there is really only one that ShipStationKernelTestBase is the only class that contains real tests, i.e. not just stubs/function signatures. This test only references commerce_order, commerce_shipping, commerce_product and profile packages, so I don't think there's anything to do to get it to run on D10. The root composer.json, however, requires "drupal/commerce": "^2.17" and "drupal/commerce_shipping": "^2.1". Do these versions need to be updated to "drupal/commerce": "^2.36" and/or "drupal/commerce_shipping": "^2.6"?

    Thank you for the help.

  • Status changed to Needs review over 1 year ago
  • 🇮🇱Israel jsacksick

    Oh... I see the tests are just useless (just checked the code), there's an additional change required to properly support D10. In the link I sent, it is explained that the order of parameters changed when calling the dispatch() method on the event dispatcher.

    Also, the bridge class has been introduced in Drupal core 9.1 (it is technically not there in 9.0).

    Note that the patch you sent isn't applicable as is (it shouldn't be generated from the drupal root but you rather need to clone the module's repo, make your changes and then use the git diff command (See https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupa... → ).

    Also had a quick look at the module in general and as far as I can see there are several coding standard issues, fixing these is probably not in the scope of this issue though... There's code commented out, calls to \Drupal:: from within services rather than using dependency injection (e.g: \Drupal::moduleHandler()->alter('commerce_shipstation_order_xml') from ShipStation.php rather than $this->moduleHandler

  • 🇬🇧United Kingdom c_archer Cumbria

    Lets create a ticket for the coding standards and I'm happy to pick up.

  • 🇺🇸United States rsnyd

    @jsacksick,
    Ok, my changes include the following:

    • core_version_requirement in info.yml to be ^9.1 || ^10
    • use statement in ShipStationOrderExportedEvent to use bridge class
    • Type hints in ShipStation to use \Symfony\Contracts\EventDispatcher\EventDispatcherInterface (from your link, NOTE: I did not change the use statement to match since the link only specifically mentions the type hints and "Since Symfony 4.3, Symfony\Component\EventDispatcher\EventDispatcherInterface extends Symfony\Contracts\EventDispatcher\EventDispatcherInterface")
    • I have created the patch from the commerce_shipstation cloned repository folder this time
    • I have not touched the coding standards or the addressed the dependency injection issues since I'm just trying to get my first patch accepted and I figure simpler is better. Happy to address these in another issue, but I see that @c_archer has already volunteered

    I hope this one is correct. Thank you for taking the time to help me.

  • 🇮🇱Israel jsacksick

    The event dispatcher parameter change isn't present in your patch (see my patch), this breaks in D10.

  • 🇺🇸United States rsnyd

    @jsacksick,
    So sorry, I'm not sure how that happened.

    Thank you again.

  • First commit to issue fork.
  • @rwanth opened merge request.
  • Status changed to Fixed over 1 year ago
  • 🇺🇸United States rwanth New York, USA
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 12 months ago
  • 🇬🇧United Kingdom c_archer Cumbria
  • 🇬🇧United Kingdom c_archer Cumbria
Production build 0.71.5 2024