From b44106c380157ff7eef37003257991c29d979277 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Sun, 23 Nov 2014 00:46:50 +0000 Subject: [PATCH] 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 --- tests/phpunit/includes/utils.php | 20 +++++++++++++++++++- tests/phpunit/tests/db.php | 17 ----------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/tests/phpunit/includes/utils.php b/tests/phpunit/includes/utils.php index d6c79e9e6b..3d91f0663d 100644 --- a/tests/phpunit/includes/utils.php +++ b/tests/phpunit/includes/utils.php @@ -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 ); -} \ No newline at end of file +} + +/** + * 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 ); + } +} diff --git a/tests/phpunit/tests/db.php b/tests/phpunit/tests/db.php index 8df0cd9b78..bd47b85e25 100644 --- a/tests/phpunit/tests/db.php +++ b/tests/phpunit/tests/db.php @@ -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 ); - } -}