Fixed unit tests for WC_Cart::get_remove_url()

This commit is contained in:
Claudio Sanches 2015-07-14 12:02:32 -03:00
parent 08b59015c4
commit 409dd81ab9
2 changed files with 7 additions and 6 deletions

View File

@ -85,8 +85,9 @@ class Cart extends \WC_Unit_Test_Case {
* @since 2.3 * @since 2.3
*/ */
public function test_get_cart_url() { public function test_get_cart_url() {
$cart_page_id = wc_get_page_id( 'cart' ); $cart_page_url = wc_get_page_permalink( 'cart' );
$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_url ? $cart_page_url : '' ), WC()->cart->get_cart_url() );
} }
/** /**
@ -96,13 +97,13 @@ class Cart extends \WC_Unit_Test_Case {
*/ */
public function test_get_remove_url() { public function test_get_remove_url() {
// Get the cart page id // Get the cart page id
$cart_page_id = wc_get_page_id( 'cart' ); $cart_page_url = wc_get_page_permalink( 'cart' );
// Test cart item key // Test cart item key
$cart_item_key = 'test'; $cart_item_key = 'test';
// Do the check // 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 ) ); $this->assertEquals( apply_filters( 'woocommerce_get_remove_url', $cart_page_url ? wp_nonce_url( add_query_arg( 'remove_item', $cart_item_key, $cart_page_url ), 'woocommerce-cart' ) : '' ), WC()->cart->get_remove_url( $cart_item_key ) );
} }
/** /**