Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/motivation
CartManager.php is not tested. Issues like #2708455: Cart totals are not updated on updating line items could be caught with tests of CartManager.
Proposed resolution
Create a Kernel test CartManagerTest.php in cart module similar to CartProviderTest.php and order.module's Kernel\Entity\OrderTest.php
Remaining tasks
- Add new test(s) for CartManager.php covering all methods.
Completed tasks
(none)
Comments
Comment #2
steveoliver CreditAttribution: steveoliver commentedhttps://github.com/drupalcommerce/commerce/pull/547 contains a test covering all CartManager methods. The first commit tests (all passing) that verify the basics of the methods--that order items are added, updated, and removed. The second commit shows a test (failing) that verifies the order total after updating the quantity of the first order item. The third commit shows the test (passing) that verified the order total after updating the quantity of the first order item -- but by manually saving the $cart inline in the test -- showing that the issue in #2708455: Cart totals are not updated on updating line items indeed exists and is currently "fixed" by saving the cart after updating item quantities.
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedMerged, thanks!