PHP Class WC_Helper_Customer

This helper class should ONLY be used for unit tests!
显示文件 Open project: woocommerce/woocommerce Class Usage Examples

Public Methods

Method Description
create_customer ( $username = 'testcustomer', $password = 'hunter2', $email = '[email protected]' ) Creates a customer in the tests DB.
create_mock_customer ( ) : WC_Customer Create a mock customer for testing purposes.
get_chosen_shipping_methods ( ) : array Get the user's chosen shipping method.
get_customer_details ( ) : array Get the customer's shipping and billing info from the session.
get_expected_store_location ( ) : array Get the expected output for the store's base location settings.
get_tax_based_on ( ) : string Get the "Tax Based On" WooCommerce option.
set_chosen_shipping_methods ( $chosen_shipping_methods ) Set the user's chosen shipping method.
set_customer_details ( $customer_details ) Set the the current customer's billing details in the session.
set_tax_based_on ( string $default_shipping_method ) Set the "Tax Based On" WooCommerce option.

Method Details

create_customer() public static method

Creates a customer in the tests DB.
public static create_customer ( $username = 'testcustomer', $password = 'hunter2', $email = '[email protected]' )

create_mock_customer() public static method

Create a mock customer for testing purposes.
public static create_mock_customer ( ) : WC_Customer
return WC_Customer

get_chosen_shipping_methods() public static method

Get the user's chosen shipping method.
public static get_chosen_shipping_methods ( ) : array
return array

get_customer_details() public static method

Get the customer's shipping and billing info from the session.
public static get_customer_details ( ) : array
return array

get_expected_store_location() public static method

Get the expected output for the store's base location settings.
public static get_expected_store_location ( ) : array
return array

get_tax_based_on() public static method

Get the "Tax Based On" WooCommerce option.
public static get_tax_based_on ( ) : string
return string base or billing

set_chosen_shipping_methods() public static method

Set the user's chosen shipping method.
public static set_chosen_shipping_methods ( $chosen_shipping_methods )

set_customer_details() public static method

Set the the current customer's billing details in the session.
public static set_customer_details ( $customer_details )

set_tax_based_on() public static method

Set the "Tax Based On" WooCommerce option.
public static set_tax_based_on ( string $default_shipping_method )
$default_shipping_method string Shipping Method slug