Fix Database Table Creation Test (https://github.com/woocommerce/woocommerce-admin/pull/6670)
* Fix mistake in documentation * Fix typo in query * Fix a bug where the tables were not being dropped
This commit is contained in:
parent
a2996ff820
commit
b48e2addeb
|
@ -20,7 +20,11 @@ class WC_Admin_Tests_Install extends WP_UnitTestCase {
|
||||||
function test_create_tables() {
|
function test_create_tables() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
// List of tables created by Install::test_create_tables.
|
// Remove the Test Suite’s use of temporary tables https://wordpress.stackexchange.com/a/220308
|
||||||
|
remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
|
||||||
|
remove_filter( 'query', array( $this, '_drop_temporary_tables' ) );
|
||||||
|
|
||||||
|
// List of tables created by Install::create_tables.
|
||||||
$tables = array(
|
$tables = array(
|
||||||
"{$wpdb->prefix}wc_order_stats",
|
"{$wpdb->prefix}wc_order_stats",
|
||||||
"{$wpdb->prefix}wc_order_product_lookup",
|
"{$wpdb->prefix}wc_order_product_lookup",
|
||||||
|
@ -33,7 +37,7 @@ class WC_Admin_Tests_Install extends WP_UnitTestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove any existing tables in the environment.
|
// Remove any existing tables in the environment.
|
||||||
$query = 'DROP TABLES IF EXISTS' . implode( ',', $tables );
|
$query = 'DROP TABLE IF EXISTS ' . implode( ',', $tables );
|
||||||
$wpdb->query( $query );
|
$wpdb->query( $query );
|
||||||
|
|
||||||
// Try to create the tables.
|
// Try to create the tables.
|
||||||
|
|
Loading…
Reference in New Issue