Unit Tests: wrote cart test_get_coupons method.
This commit is contained in:
parent
f6fbdcd0ec
commit
3d7108278d
|
@ -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 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue