Revert most of 74a3f1d6
As @claudiosanches pointed out, there isn't much real-world need for `WC_Install::get_tables()` to sort results. Instead, sort the returned value within the `WC_Tests_Install::test_get_tables()` method.
This commit is contained in:
parent
226aedd4e2
commit
317e7ba29f
|
@ -809,9 +809,6 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
|
||||||
*/
|
*/
|
||||||
$tables = apply_filters( 'woocommerce_install_get_tables', $tables );
|
$tables = apply_filters( 'woocommerce_install_get_tables', $tables );
|
||||||
|
|
||||||
// Sort the tables alphabetically.
|
|
||||||
sort( $tables );
|
|
||||||
|
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,8 +122,10 @@ class WC_Tests_Install extends WC_Unit_Test_Case {
|
||||||
$tables = $wpdb->get_col(
|
$tables = $wpdb->get_col(
|
||||||
"SHOW TABLES WHERE `Tables_in_{$wpdb->dbname}` LIKE '{$wpdb->prefix}woocommerce\_%' OR `Tables_in_{$wpdb->dbname}` LIKE '{$wpdb->prefix}wc\_%'"
|
"SHOW TABLES WHERE `Tables_in_{$wpdb->dbname}` LIKE '{$wpdb->prefix}woocommerce\_%' OR `Tables_in_{$wpdb->dbname}` LIKE '{$wpdb->prefix}wc\_%'"
|
||||||
);
|
);
|
||||||
|
$result = WC_Install::get_tables();
|
||||||
|
sort( $result );
|
||||||
|
|
||||||
$this->assertEquals( $tables, WC_Install::get_tables() );
|
$this->assertEquals( $tables, $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,31 +148,4 @@ class WC_Tests_Install extends WC_Unit_Test_Case {
|
||||||
|
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test - WC_Install::get_tables() should sort tables alphabetically.
|
|
||||||
*/
|
|
||||||
public function test_get_tables_sorts_results() {
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
add_filter( 'woocommerce_install_get_tables', array( $this, 'append_tables_for_sorting' ) );
|
|
||||||
|
|
||||||
$sorted = WC_Install::get_tables();
|
|
||||||
sort( $sorted );
|
|
||||||
|
|
||||||
$this->assertEquals( $sorted, WC_Install::get_tables() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter callback for test_get_tables_sorts_results().
|
|
||||||
*/
|
|
||||||
public function append_tables_for_sorting( $tables ) {
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
$tables[] = "{$wpdb->prefix}wc_another_table";
|
|
||||||
$tables[] = "{$wpdb->prefix}woocommerce_another_one";
|
|
||||||
$tables[] = "{$wpdb->prefix}woocommerce_yet_another_table";
|
|
||||||
|
|
||||||
return $tables;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue