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

Files: 
CommentFileSizeAuthor
#4 1576894-uc_cart_empty-default.patch1.84 KBlongwave
PASSED: [[SimpleTest]]: [MySQL] 2,455 pass(es).
[ View ]
#3 1576894-uc_cart_remove_item-rebuild.patch997 byteslongwave
PASSED: [[SimpleTest]]: [MySQL] 2,457 pass(es).
[ View ]
uc_cart-tests.patch5.4 KBlongwave
PASSED: [[SimpleTest]]: [MySQL] 2,171 pass(es).
[ View ]

Comments

Status:Needs review» Active

Committed the patch, back to active to improve the API as noted.

I backported and committed above patch to D6, http://drupalcode.org/project/ubercart.git/commitdiff/390b81886c

Status:Active» Needs review
StatusFileSize
new997 bytes
PASSED: [[SimpleTest]]: [MySQL] 2,457 pass(es).
[ View ]

uc_cart_remove_item() improvement

StatusFileSize
new1.84 KB
PASSED: [[SimpleTest]]: [MySQL] 2,455 pass(es).
[ View ]

uc_cart_empty() improvement

#4: 1576894-uc_cart_empty-default.patch queued for re-testing.

Committed #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.

Status:Needs review» Fixed

Marking fixed based on #7, reviewing this again I don't see the point in changing uc_cart_remove_item().

Status:Fixed» Closed (fixed)

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