Ensure that wpdb_exposed_methods_for_testing is available to all tests.

It should be defined in a common library file so that all tests have access to
it, even when run in isolation.

See [30345], #21212.

git-svn-id: https://develop.svn.wordpress.org/trunk@30528 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2014-11-23 00:46:50 +00:00
parent 4992fdb95f
commit b44106c380
2 changed files with 19 additions and 18 deletions

View File

@ -353,4 +353,22 @@ function _cleanup_query_vars() {
function _clean_term_filters() {
remove_filter( 'get_terms', array( 'Featured_Content', 'hide_featured_term' ), 10, 2 );
remove_filter( 'get_the_terms', array( 'Featured_Content', 'hide_the_featured_term' ), 10, 3 );
}
}
/**
* Special class for exposing protected wpdb methods we need to access
*/
class wpdb_exposed_methods_for_testing extends wpdb {
public function __construct() {
global $wpdb;
$this->dbh = $wpdb->dbh;
$this->use_mysqli = $wpdb->use_mysqli;
$this->ready = true;
$this->field_types = $wpdb->field_types;
$this->charset = $wpdb->charset;
}
public function __call( $name, $arguments ) {
return call_user_func_array( array( $this, $name ), $arguments );
}
}

View File

@ -923,20 +923,3 @@ class Tests_DB extends WP_UnitTestCase {
}
}
/**
* Special class for exposing protected wpdb methods we need to access
*/
class wpdb_exposed_methods_for_testing extends wpdb {
public function __construct() {
global $wpdb;
$this->dbh = $wpdb->dbh;
$this->use_mysqli = $wpdb->use_mysqli;
$this->ready = true;
$this->field_types = $wpdb->field_types;
$this->charset = $wpdb->charset;
}
public function __call( $name, $arguments ) {
return call_user_func_array( array( $this, $name ), $arguments );
}
}