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
Issue fork commerce_api-3590493
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
Comment #6
jsacksick commented