Make WordPress Core

Ticket #29827: 29827.2.patch

File 29827.2.patch, 1.6 KB (added by nacin, 10 years ago)
  • tests/phpunit/includes/testcase.php

     
    1010        protected $caught_deprecated = array();
    1111        protected $expected_doing_it_wrong = array();
    1212        protected $caught_doing_it_wrong = array();
     13        protected $registered_taxonomy = array();
     14        protected $registered_post_type = array();
    1315
    1416        protected static $hooks_saved = array();
    1517        protected static $ignore_files;
     
    4042                $this->start_transaction();
    4143                $this->expectDeprecated();
    4244                add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
     45                add_action( 'registered_taxonomy', array( $this, 'object_registered' ) );
     46                add_action( 'registered_post_type', array( $this, 'object_registered' ) );
    4347        }
    4448
    4549        function tearDown() {
     
    5761                remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
    5862                remove_filter( 'query', array( $this, '_drop_temporary_tables' ) );
    5963                remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
     64
     65                foreach ( $registered_taxonomy as $tax ) {
     66                        _unregister_taxonomy( $tax );
     67                }
     68                foreach ( $registered_post_type as $pt ) {
     69                        _unregister_post_type( $pt );
     70                }
     71
    6072                $this->_restore_hooks();
    6173        }
    6274
     
    103115                        }
    104116                }
    105117        }
    106        
     118
     119        public function object_registered( $name ) {
     120                $action = current_filter();
     121                $this->$object_registered[] = $name;
     122        }
     123
    107124        function flush_cache() {
    108125                global $wp_object_cache;
    109126                $wp_object_cache->group_ops = array();