Make WordPress Core

Ticket #33968: awesome.diff

File awesome.diff, 1.1 KB (added by wonderboymusic, 10 years ago)
  • tests/phpunit/includes/testcase.php

     
    1414        protected static $hooks_saved = array();
    1515        protected static $ignore_files;
    1616
     17        function __isset( $name ) {
     18                return 'factory' === $name;
     19        }
     20
    1721        /**
    1822         * @var WP_UnitTest_Factory
    1923         */
    20         protected static $factory;
     24        function __get( $name ) {
     25                if ( 'factory' === $name ) {
     26                        return self::factory();
     27                }
     28        }
    2129
     30        protected static function factory() {
     31                static $factory = null;
     32
     33                if ( ! $factory ) {
     34                        $factory = new WP_UnitTest_Factory();
     35                }
     36
     37                return $factory;
     38        }
     39
    2240        public static function get_called_class() {
    2341                if ( function_exists( 'get_called_class' ) ) {
    2442                        return get_called_class();
     
    8199                $wpdb->db_connect();
    82100                ini_set('display_errors', 1 );
    83101                $this->clean_up_global_scope();
    84 
    85102                /*
    86103                 * When running core tests, ensure that post types and taxonomies
    87104                 * are reset for each test. We skip this step for non-core tests,