woocommerce/plugins/woocommerce-admin/tests/framework/helpers/class-wc-helper-reports.php

27 lines
1.0 KiB
PHP
Raw Normal View History

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;
$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.
\Automattic\WooCommerce\Admin\CategoryLookup::instance()->regenerate();
2018-09-20 14:20:04 +00:00
}
}