| 383 | |
| 384 | /** |
| 385 | * @ticket 41185 |
| 386 | */ |
| 387 | public function test_current_priority_after_nested_add_action(){ |
| 388 | add_action( 'test_current_priority', array( $this, '_nested_action' ), 99 ); |
| 389 | do_action( 'test_current_priority' ); |
| 390 | remove_action( 'test_current_priority', array( $this, '_nested_action' ), 99 ); |
| 391 | remove_action( 'test_current_priority', array( $this, '__return_false' ), 100 ); |
| 392 | |
| 393 | $this->assertSame( 99, $this->current_priority ); |
| 394 | } |
| 395 | |
| 396 | public function _nested_action() { |
| 397 | add_action( 'test_current_priority', '__return_false', 100 ); |
| 398 | |
| 399 | global $wp_filter; |
| 400 | $this->current_priority = $wp_filter[ current_filter() ]->current_priority(); |
| 401 | } |
| 402 | |
| 403 | /** |
| 404 | * @ticket 41185 |
| 405 | */ |
| 406 | |
| 407 | public function test_current_filter(){ |
| 408 | add_action( 'test_current_priority', array( $this, '_match_current_filter' ), 99 ); |
| 409 | do_action( 'test_current_priority' ); |
| 410 | } |
| 411 | |
| 412 | public function _match_current_filter(){ |
| 413 | remove_action( 'test_current_priority', array( $this, '_match_current_filter' ), 99 ); |
| 414 | |
| 415 | global $wp_filter; |
| 416 | $this->assertTrue( array_key_exists( current_filter(), $wp_filter ) ); |
| 417 | } |
| 418 | |