Make WordPress Core

Ticket #29070: 29070.3.diff

File 29070.3.diff, 1.3 KB (added by pento, 10 years ago)
  • tests/phpunit/tests/filters.php

     
    293293                remove_all_filters( $tag, 12 );
    294294                $this->assertFalse( has_filter( $tag ) );
    295295        }
     296
     297        /**
     298         * @ticket 29070
     299         */
     300         function test_has_filter_doesnt_reset_wp_filter() {
     301                add_action( 'action_test_has_filter_doesnt_reset_wp_filter', '__return_null', 1 );
     302                add_action( 'action_test_has_filter_doesnt_reset_wp_filter', '__return_null', 2 );
     303                add_action( 'action_test_has_filter_doesnt_reset_wp_filter', '__return_null', 3 );
     304                add_action( 'action_test_has_filter_doesnt_reset_wp_filter', array( $this, '_action_test_has_filter_doesnt_reset_wp_filter' ), 4 );
     305
     306                do_action( 'action_test_has_filter_doesnt_reset_wp_filter' );
     307         }
     308         function _action_test_has_filter_doesnt_reset_wp_filter() {
     309                global $wp_filter;
     310
     311                has_action( 'action_test_has_filter_doesnt_reset_wp_filter', '_function_that_doesnt_exist' );
     312
     313                $filters = current( $wp_filter['action_test_has_filter_doesnt_reset_wp_filter'] );
     314                $the_ = current( $filters );
     315                $this->assertEquals( $the_['function'], array( $this, '_action_test_has_filter_doesnt_reset_wp_filter' ) );
     316         }
    296317}