From a4bb50aaa5e133ff4e3029ffa6124c22a285a43d Mon Sep 17 00:00:00 2001 From: Barry Kooij Date: Fri, 24 Oct 2014 20:56:56 +0200 Subject: [PATCH] Unit Tests: added test_get_remove_url --- tests/unit-tests/cart.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/unit-tests/cart.php b/tests/unit-tests/cart.php index 91a54b0ee01..e1d706e0922 100644 --- a/tests/unit-tests/cart.php +++ b/tests/unit-tests/cart.php @@ -74,7 +74,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { } /** - * Test test_get_cart_url method + * Test get_cart_url method * * @since 2.3 */ @@ -83,6 +83,22 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { $this->assertEquals( apply_filters( 'woocommerce_get_cart_url', $cart_page_id ? get_permalink( $cart_page_id ) : '' ), WC()->cart->get_cart_url() ); } + /** + * Test get_remove_url + * + * @since 2.3 + */ + public function test_get_remove_url() { + // Get the cart page id + $cart_page_id = wc_get_page_id( 'cart' ); + + // Test cart item key + $cart_item_key = 'test'; + + // Do the check + $this->assertEquals( apply_filters( 'woocommerce_get_remove_url', $cart_page_id ? wp_nonce_url( add_query_arg( 'remove_item', $cart_item_key, get_permalink( $cart_page_id ) ), 'woocommerce-cart' ) : '' ), WC()->cart->get_remove_url( $cart_item_key ) ); + } + /** * Test add to cart simple product *