Add edge case test

This commit is contained in:
claudiulodro 2017-06-13 14:00:12 -07:00
parent 489e67dbe1
commit 62064d56f8
2 changed files with 4 additions and 1 deletions

View File

@ -655,7 +655,7 @@ class WC_Order_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT implement
if ( isset( $query_vars['customer'] ) && '' !== $query_vars['customer'] && array() !== $query_vars['customer'] ) {
$values = is_array( $query_vars['customer'] ) ? $query_vars['customer'] : array( $query_vars['customer'] );
$customer_query = $this->get_orders_generate_customer_meta_query( $values );
if ( is_wp_error( $customer_query) ) {
if ( is_wp_error( $customer_query ) ) {
$wp_query_args['errors'][] = $customer_query;
} else {
$wp_query_args['meta_query'][] = $customer_query;

View File

@ -657,6 +657,9 @@ class WC_Tests_Order_Functions extends WC_Unit_Test_Case {
$orders = wc_get_orders( array( 'customer' => array( 'invalid' ) ) );
$this->assertEmpty( $orders );
$orders = wc_get_orders( array( 'customer' => array( '' ) ) );
$this->assertEmpty( $orders );
$orders = wc_get_orders( array( 'customer' => 'doesnt@exist.com' ) );
$this->assertEmpty( $orders );
}