Fixed unit tests for WC_Cart::get_remove_url()
This commit is contained in:
parent
08b59015c4
commit
409dd81ab9
|
@ -634,7 +634,7 @@ class WC_Cart {
|
|||
* @return string url to page
|
||||
*/
|
||||
public function get_checkout_url() {
|
||||
$checkout_url = wc_get_page_permalink( 'checkout' );
|
||||
$checkout_url = wc_get_page_permalink( 'checkout' );
|
||||
if ( $checkout_url ) {
|
||||
// Force SSL if needed
|
||||
if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) {
|
||||
|
@ -651,7 +651,7 @@ class WC_Cart {
|
|||
* @return string url to page
|
||||
*/
|
||||
public function get_remove_url( $cart_item_key ) {
|
||||
$cart_page_url = wc_get_page_permalink('cart');
|
||||
$cart_page_url = wc_get_page_permalink( 'cart' );
|
||||
return 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' ) : '' );
|
||||
}
|
||||
|
||||
|
|
|
@ -85,8 +85,9 @@ class Cart extends \WC_Unit_Test_Case {
|
|||
* @since 2.3
|
||||
*/
|
||||
public function test_get_cart_url() {
|
||||
$cart_page_id = wc_get_page_id( 'cart' );
|
||||
$this->assertEquals( apply_filters( 'woocommerce_get_cart_url', $cart_page_id ? get_permalink( $cart_page_id ) : '' ), WC()->cart->get_cart_url() );
|
||||
$cart_page_url = wc_get_page_permalink( 'cart' );
|
||||
|
||||
$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() {
|
||||
// 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
|
||||
$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 ) );
|
||||
$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 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue