Unit Tests: wrote cart test_get_coupons method.

This commit is contained in:
Barry Kooij 2014-11-11 14:28:52 +01:00
parent f6fbdcd0ec
commit 3d7108278d
1 changed files with 24 additions and 0 deletions

View File

@ -510,4 +510,28 @@ class WC_Tests_Cart extends WC_Unit_Test_Case {
WC_Helper_Product::delete_product( $product->id );
}
/**
* Test cart coupons
*/
public function test_get_coupons() {
// Create coupon
$coupon = WC_Helper_Coupon::create_coupon();
// Add coupon
WC()->cart->add_discount( $coupon->code );
$this->assertEquals( count( WC()->cart->get_coupons() ), 1 );
// Clean up the cart
WC()->cart->empty_cart();
// Remove coupons
WC()->cart->remove_coupons();
// Delete coupon
WC_Helper_Coupon::delete_coupon( $coupon->id );
}
}