Make WordPress Core

Changeset 30528


Ignore:
Timestamp:
11/23/2014 12:46:50 AM (12 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.

Location:
trunk/tests/phpunit
Files:
2 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}
  • trunk/tests/phpunit/tests/db.php

    r30400 r30528  
    924924}
    925925
    926 /**
    927  * Special class for exposing protected wpdb methods we need to access
    928  */
    929 class wpdb_exposed_methods_for_testing extends wpdb {
    930         public function __construct() {
    931                 global $wpdb;
    932                 $this->dbh = $wpdb->dbh;
    933                 $this->use_mysqli = $wpdb->use_mysqli;
    934                 $this->ready = true;
    935                 $this->field_types = $wpdb->field_types;
    936                 $this->charset = $wpdb->charset;
    937         }
    938 
    939         public function __call( $name, $arguments ) {
    940                 return call_user_func_array( array( $this, $name ), $arguments );
    941         }
    942 }
Note: See TracChangeset for help on using the changeset viewer.