Problem/Motivation

The commerce_api module tests are failing because they use the deprecated function commerce_shipping_build_shipment_field_definition() which has been removed from commerce_shipping module. The function has been replaced with the OOP method Shipment::buildShipmentsFieldDefinition() in commerce_shipping 8.x-2.x.
I believe it's related to this ticket at commerce_shipping project: https://www.drupal.org/project/commerce_shipping/issues/3557638

Steps to reproduce

1. Install commerce_api module with commerce_shipping 8.x-2.x
2. Run the commerce_api tests: phpunit web/modules/contrib/commerce_api
3. Observe failures in all Cart test classes with error: Call to undefined function Drupal\Tests\commerce_api\Functional\commerce_shipping_build_shipment_field_definition()

Proposed resolution

Update commerce_api module to use the new OOP method:
- Replace commerce_shipping_build_shipment_field_definition($order_type->id()) with \Drupal\commerce_shipping\Entity\Shipment::buildShipmentsFieldDefinition($order_type->id())
- Update both occurrences in:
- web/modules/contrib/commerce_api/tests/src/Functional/CheckoutApiResourceTestBase.php:96
- web/modules/contrib/commerce_api/tests/src/Kernel/KernelTestBase.php:84

Remaining tasks

- Update the function calls in commerce_api module
- Verify tests pass with the new method

User interface changes

None

API changes

- Deprecated procedural function commerce_shipping_build_shipment_field_definition() removed
- Replaced with static method Shipment::buildShipmentsFieldDefinition()

Data model changes

None

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jsobiecki created an issue. See original summary.

tbkot made their first commit to this issue’s fork.

jsacksick made their first commit to this issue’s fork.

  • jsacksick committed e8c70e19 on 8.x-1.x authored by tbkot
    fix: #3590493 Fix tests of commerce_api after update of...
jsacksick’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.