You appear to be a bot. Output may be restricted
Description
Usage
Tests_Filters::test_filter_priority();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/filters.php
Lines:
1 to 31 of 31
public function test_filter_priority() { $a = new MockAction(); $tag = __FUNCTION__; $val = __FUNCTION__ . '_val'; // Make two filters with different priorities. add_filter( $tag, array( $a, 'filter' ), 10 ); add_filter( $tag, array( $a, 'filter2' ), 9 ); $this->assertSame( $val, apply_filters( $tag, $val ) ); // There should be two events, one per filter. $this->assertSame( 2, $a->get_call_count() ); $expected = array( // 'filter2' is called first because it has priority 9. array( 'filter' => 'filter2', 'tag' => $tag, 'args' => array( $val ), ), // 'filter' is called second. array( 'filter' => 'filter', 'tag' => $tag, 'args' => array( $val ), ), ); $this->assertSame( $expected, $a->get_events() ); }