WordPress.org

Make WordPress Core

Ticket #31362: 31362.diff

File 31362.diff, 2.1 KB (added by jdgrimes, 5 years ago)
  • tests/phpunit/includes/testcase.php

     
    5555                add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
    5656        }
    5757
     58        function assertPostConditions() {
     59                $this->expectedDeprecated();
     60        }
     61
    5862        function tearDown() {
    5963                global $wpdb, $wp_query, $post;
    60                 $this->expectedDeprecated();
    6164                $wpdb->query( 'ROLLBACK' );
    6265                if ( is_multisite() ) {
    6366                        while ( ms_is_switched() ) {
     
    223226                add_action( 'doing_it_wrong_trigger_error',      '__return_false' );
    224227        }
    225228
    226         function expectedDeprecated() {
     229        function expectedDeprecated() {
     230                $errors = array();
     231
    227232                $not_caught_deprecated = array_diff( $this->expected_deprecated, $this->caught_deprecated );
    228233                foreach ( $not_caught_deprecated as $not_caught ) {
    229                         $this->fail( "Failed to assert that $not_caught triggered a deprecated notice" );
     234                        $errors[] = "Failed to assert that $not_caught triggered a deprecated notice";
    230235                }
    231236
    232237                $unexpected_deprecated = array_diff( $this->caught_deprecated, $this->expected_deprecated );
    233238                foreach ( $unexpected_deprecated as $unexpected ) {
    234                         $this->fail( "Unexpected deprecated notice for $unexpected" );
     239                        $errors[] = "Unexpected deprecated notice for $unexpected";
    235240                }
    236241
    237242                $not_caught_doing_it_wrong = array_diff( $this->expected_doing_it_wrong, $this->caught_doing_it_wrong );
    238243                foreach ( $not_caught_doing_it_wrong as $not_caught ) {
    239                         $this->fail( "Failed to assert that $not_caught triggered an incorrect usage notice" );
     244                        $errors[] = "Failed to assert that $not_caught triggered an incorrect usage notice";
    240245                }
    241246
    242247                $unexpected_doing_it_wrong = array_diff( $this->caught_doing_it_wrong, $this->expected_doing_it_wrong );
    243248                foreach ( $unexpected_doing_it_wrong as $unexpected ) {
    244                         $this->fail( "Unexpected incorrect usage notice for $unexpected" );
     249                        $errors[] = "Unexpected incorrect usage notice for $unexpected";
    245250                }
     251
     252                if ( ! empty( $errors ) ) {
     253                        $this->fail( implode( "\n", $errors ) );
     254                }
    246255        }
    247256
    248257        /**