* Fix mistake in documentation

* Fix typo in query

* Fix a bug where the tables were not being dropped
This commit is contained in:
Adrian Duffell 2021-03-26 21:52:54 +08:00 committed by GitHub
parent a2996ff820
commit b48e2addeb
1 changed files with 6 additions and 2 deletions

View File

@ -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 Suites 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.