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.
While looking at the patch provided in #1492626: "Cart Items" triggers dont work I realised we need more cart tests to prove changes there will not break anything.
The attached patch extends tests for the cart API and also suggests two improvements:
- uc_cart_remove_item() should clear the cart cache
- uc_cart_empty() should default to the current cart
Comment | File | Size | Author |
---|---|---|---|
#4 | 1576894-uc_cart_empty-default.patch | 1.84 KB | longwave |
#3 | 1576894-uc_cart_remove_item-rebuild.patch | 997 bytes | longwave |
uc_cart-tests.patch | 5.4 KB | longwave | |
Comments
Comment #1
longwaveCommitted the patch, back to active to improve the API as noted.
Comment #2
TR CreditAttribution: TR commentedI backported and committed above patch to D6, http://drupalcode.org/project/ubercart.git/commitdiff/390b81886c
Comment #3
longwaveuc_cart_remove_item() improvement
Comment #4
longwaveuc_cart_empty() improvement
Comment #5
TR CreditAttribution: TR commented#3: 1576894-uc_cart_remove_item-rebuild.patch queued for re-testing.
Comment #6
TR CreditAttribution: TR commented#4: 1576894-uc_cart_empty-default.patch queued for re-testing.
Comment #7
longwaveCommitted #4.
I am not sure whether #3 is actually justified; we provide the 'rebuild' parameter for a reason, this will reduce performance when emptying large carts, and this only fixes a test.
Comment #8
longwaveMarking fixed based on #7, reviewing this again I don't see the point in changing uc_cart_remove_item().