PHP Class WC_Helper_Customer

This helper class should ONLY be used for unit tests!
Afficher le fichier Open project: woocommerce/woocommerce Class Usage Examples

Méthodes publiques

Méthode 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 méthode

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

create_mock_customer() public static méthode

Create a mock customer for testing purposes.
public static create_mock_customer ( ) : WC_Customer
Résultat WC_Customer

get_chosen_shipping_methods() public static méthode

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

get_customer_details() public static méthode

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

get_expected_store_location() public static méthode

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

get_tax_based_on() public static méthode

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

set_chosen_shipping_methods() public static méthode

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

set_customer_details() public static méthode

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

set_tax_based_on() public static méthode

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