2018-09-20 14:20:04 +00:00
|
|
|
<?php
|
2018-12-12 18:58:26 +00:00
|
|
|
/**
|
|
|
|
* Helper code for wc-admin unit tests.
|
|
|
|
*
|
|
|
|
* @package WooCommerce\Tests\Framework\Helpers
|
|
|
|
*/
|
2018-09-20 14:20:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class WC_Helper_Reports.
|
|
|
|
*
|
|
|
|
* This helper class should ONLY be used for unit tests!.
|
|
|
|
*/
|
|
|
|
class WC_Helper_Reports {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete everything in the lookup tables.
|
|
|
|
*/
|
|
|
|
public static function reset_stats_dbs() {
|
|
|
|
global $wpdb;
|
2019-08-05 18:14:25 +00:00
|
|
|
$wpdb->query( "DELETE FROM $wpdb->prefix" . \Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore::TABLE_NAME ); // @codingStandardsIgnoreLine.
|
|
|
|
$wpdb->query( "DELETE FROM $wpdb->prefix" . \Automattic\WooCommerce\Admin\API\Reports\Products\DataStore::TABLE_NAME ); // @codingStandardsIgnoreLine.
|
|
|
|
$wpdb->query( "DELETE FROM $wpdb->prefix" . \Automattic\WooCommerce\Admin\API\Reports\Coupons\DataStore::TABLE_NAME ); // @codingStandardsIgnoreLine.
|
|
|
|
$wpdb->query( "DELETE FROM $wpdb->prefix" . \Automattic\WooCommerce\Admin\API\Reports\Customers\DataStore::TABLE_NAME ); // @codingStandardsIgnoreLine.
|
2019-10-01 23:35:37 +00:00
|
|
|
\Automattic\WooCommerce\Admin\CategoryLookup::instance()->regenerate();
|
2018-09-20 14:20:04 +00:00
|
|
|
}
|
|
|
|
}
|