Unit Tests: test_coupons_enabled, test_ship_to_billing_address_only, test_needs_shipping_address
This commit is contained in:
parent
75484c6d43
commit
26073e5668
|
@ -402,4 +402,32 @@ class WC_Tests_Cart extends WC_Unit_Test_Case {
|
|||
update_option( 'woocommerce_calc_taxes', 'no' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test coupons_enabled method
|
||||
*/
|
||||
public function test_coupons_enabled() {
|
||||
$this->assertEquals( apply_filters( 'woocommerce_coupons_enabled', get_option( 'woocommerce_enable_coupons' ) == 'yes' ), WC()->cart->coupons_enabled() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ship_to_billing_address_only method
|
||||
*/
|
||||
public function test_ship_to_billing_address_only() {
|
||||
$this->assertEquals( wc_ship_to_billing_address_only(), WC()->cart->ship_to_billing_address_only() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test needs_shipping_address method
|
||||
*/
|
||||
public function test_needs_shipping_address() {
|
||||
$needs_shipping_address = false;
|
||||
|
||||
if ( WC()->cart->needs_shipping() === true && ! WC()->cart->ship_to_billing_address_only() ) {
|
||||
$needs_shipping_address = true;
|
||||
}
|
||||
|
||||
$this->assertEquals( apply_filters( 'woocommerce_cart_needs_shipping_address', $needs_shipping_address ), WC()->cart->needs_shipping_address() );
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue