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() ); // Delete the previously created product \WC_Helper_Product::delete_product( $product->id ); } }