Try: Fix failing returning customer test (https://github.com/woocommerce/woocommerce-admin/pull/1496)
* Don't check against same order when checking for returning customer * Sleep between order creation * Add todo removal comments for sleep functions
This commit is contained in:
parent
79e22bcefd
commit
2b0c8089c0
|
@ -525,9 +525,10 @@ class WC_Admin_Reports_Orders_Stats_Data_Store extends WC_Admin_Reports_Data_Sto
|
|||
|
||||
$customer_orders = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT COUNT(*) FROM ${orders_stats_table} WHERE customer_id = %d AND date_created < %s",
|
||||
"SELECT COUNT(*) FROM ${orders_stats_table} WHERE customer_id = %d AND date_created < %s AND order_id != %d",
|
||||
$customer_id,
|
||||
date( 'Y-m-d H:i:s', $order->get_date_created()->getTimestamp() )
|
||||
date( 'Y-m-d H:i:s', $order->get_date_created()->getTimestamp() ),
|
||||
$order->get_id()
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ class WC_Tests_Reports_Orders_Stats extends WC_Unit_Test_Case {
|
|||
$order->save();
|
||||
|
||||
// Wait one second to avoid potentially ambiguous new/returning customer.
|
||||
sleep( 1 );
|
||||
sleep( 1 ); // @todo Remove this after p90Yrv-XN-p2 is resolved.
|
||||
}
|
||||
|
||||
WC_Helper_Queue::run_all_pending();
|
||||
|
@ -4732,6 +4732,7 @@ class WC_Tests_Reports_Orders_Stats extends WC_Unit_Test_Case {
|
|||
) as $order_time
|
||||
) {
|
||||
// Order with 1 product.
|
||||
sleep( 1 ); // @todo Remove this after p90Yrv-XN-p2 is resolved.
|
||||
$order = WC_Helper_Order::create_order( $customer->get_id(), $product );
|
||||
$order->set_date_created( $order_time );
|
||||
$order->set_status( $order_status );
|
||||
|
|
Loading…
Reference in New Issue