public function UbercartCartCheckoutTestCase::testDeletedCartItem in Ubercart 7.3
Same name and namespace in other branches
- 6.2 uc_cart/uc_cart.test \UbercartCartCheckoutTestCase::testDeletedCartItem()
Tests that cart automatically removes products that have been deleted.
File
- uc_cart/
tests/ uc_cart.test, line 193 - Shopping cart and checkout tests.
Class
- UbercartCartCheckoutTestCase
- Tests the cart and checkout functionality.
Code
public function testDeletedCartItem() {
// Add a product to the cart, then delete the node.
$this
->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));
node_delete($this->product->nid);
// Test that the cart is empty.
$this
->drupalGet('cart');
$this
->assertText('There are no products in your shopping cart.');
$this
->assertEqual(uc_cart_get_total_qty(), 0, 'There are no items in the cart.');
}