wc-cart-functions - unit tests begin
This commit is contained in:
parent
b7f881c2fb
commit
6ac167ac36
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Test WC cart functions
|
||||||
|
*
|
||||||
|
* @since 2.3.0
|
||||||
|
*/
|
||||||
|
class WC_Tests_Cart_Functions extends WC_Unit_Test_Case {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test wc_empty_cart()
|
||||||
|
*
|
||||||
|
* @since 2.3.0
|
||||||
|
*/
|
||||||
|
public function test_wc_empty_cart() {
|
||||||
|
// Create dummy product
|
||||||
|
$product = WC_Helper_Product::create_simple_product();
|
||||||
|
|
||||||
|
// Add the product to the cart
|
||||||
|
WC()->cart->add_to_cart( $product->id, 1 );
|
||||||
|
|
||||||
|
// Empty the cart
|
||||||
|
wc_empty_cart();
|
||||||
|
|
||||||
|
// Check if the cart is empty
|
||||||
|
$this->assertEquals( 0, WC()->cart->get_cart_contents_count() );
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue