Unit Tests: added test_get_remove_url

This commit is contained in:
Barry Kooij 2014-10-24 20:56:56 +02:00
parent 80dc739ef0
commit a4bb50aaa5
1 changed files with 17 additions and 1 deletions

View File

@ -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 * @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() ); $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 * Test add to cart simple product
* *