Merge pull request woocommerce/woocommerce-admin#1502 from woocommerce/fix/1489

Fixed WordPress database error in unit tests
This commit is contained in:
Claudio Sanches 2019-02-08 16:22:00 -02:00 committed by GitHub
commit fb02d78a3d
1 changed files with 3 additions and 1 deletions

View File

@ -35,12 +35,14 @@ class WC_Tests_API_Init extends WC_REST_Unit_Test_Case {
* @return string
*/
public function filter_order_query( $query ) {
global $wpdb;
if (
0 === strpos( $query, 'REPLACE INTO' ) &&
false !== strpos( $query, WC_Admin_Reports_Orders_Stats_Data_Store::TABLE_NAME )
) {
remove_filter( 'query', array( $this, 'filter_order_query' ) );
return 'THIS WONT MATCH';
return "DESCRIBE $wpdb->posts"; // Execute any random query.
}
return $query;