Make WordPress Core


Ignore:
Timestamp:
11/23/2014 12:46:50 AM (10 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/utils.php

    r29120 r30528  
    355355    remove_filter( 'get_the_terms', array( 'Featured_Content', 'hide_the_featured_term' ), 10, 3 );
    356356}
     357
     358/**
     359 * Special class for exposing protected wpdb methods we need to access
     360 */
     361class wpdb_exposed_methods_for_testing extends wpdb {
     362    public function __construct() {
     363        global $wpdb;
     364        $this->dbh = $wpdb->dbh;
     365        $this->use_mysqli = $wpdb->use_mysqli;
     366        $this->ready = true;
     367        $this->field_types = $wpdb->field_types;
     368        $this->charset = $wpdb->charset;
     369    }
     370
     371    public function __call( $name, $arguments ) {
     372        return call_user_func_array( array( $this, $name ), $arguments );
     373    }
     374}
Note: See TracChangeset for help on using the changeset viewer.