You appear to be a bot. Output may be restricted
Description
Usage
Tests_Actions::test_action_callback_manipulation_while_running();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/actions.php
Lines:
1 to 22 of 22
public function test_action_callback_manipulation_while_running() { $tag = __FUNCTION__; $a = new MockAction(); $b = new MockAction(); $c = new MockAction(); $d = new MockAction(); $e = new MockAction(); add_action( $tag, array( $a, 'action' ), 11, 2 ); add_action( $tag, array( $this, 'action_that_manipulates_a_running_hook' ), 12, 2 ); add_action( $tag, array( $b, 'action' ), 12, 2 ); do_action( $tag, $tag, array( $a, $b, $c, $d, $e ) ); do_action( $tag, $tag, array( $a, $b, $c, $d, $e ) ); $this->assertSame( 2, $a->get_call_count(), 'callbacks should run unless otherwise instructed' ); $this->assertSame( 1, $b->get_call_count(), 'callback removed by same priority callback should still get called' ); $this->assertSame( 1, $c->get_call_count(), 'callback added by same priority callback should not get called' ); $this->assertSame( 2, $d->get_call_count(), 'callback added by earlier priority callback should get called' ); $this->assertSame( 1, $e->get_call_count(), 'callback added by later priority callback should not get called' ); }