Changeset 53804 for trunk/tests/phpunit/tests/hooks/doAction.php
- Timestamp:
- 07/31/2022 03:03:46 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/hooks/doAction.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/hooks/doAction.php
r52389 r53804 21 21 $callback = array( $a, 'action' ); 22 22 $hook = new WP_Hook(); 23 $ tag= __FUNCTION__;23 $hook_name = __FUNCTION__; 24 24 $priority = 1; 25 25 $accepted_args = 2; 26 26 $arg = __FUNCTION__ . '_arg'; 27 27 28 $hook->add_filter( $ tag, $callback, $priority, $accepted_args );28 $hook->add_filter( $hook_name, $callback, $priority, $accepted_args ); 29 29 $hook->do_action( array( $arg ) ); 30 30 … … 36 36 $callback = array( $a, 'filter' ); 37 37 $hook = new WP_Hook(); 38 $ tag= __FUNCTION__;38 $hook_name = __FUNCTION__; 39 39 $priority = 1; 40 40 $accepted_args = 2; 41 41 $arg = __FUNCTION__ . '_arg'; 42 42 43 $hook->add_filter( $ tag, $callback, $priority, $accepted_args );43 $hook->add_filter( $hook_name, $callback, $priority, $accepted_args ); 44 44 $hook->do_action( array( $arg ) ); 45 45 $hook->do_action( array( $arg ) ); … … 54 54 $callback_two = array( $b, 'filter' ); 55 55 $hook = new WP_Hook(); 56 $ tag= __FUNCTION__;56 $hook_name = __FUNCTION__; 57 57 $priority = 1; 58 58 $accepted_args = 2; 59 59 $arg = __FUNCTION__ . '_arg'; 60 60 61 $hook->add_filter( $ tag, $callback_one, $priority, $accepted_args );62 $hook->add_filter( $ tag, $callback_two, $priority, $accepted_args );61 $hook->add_filter( $hook_name, $callback_one, $priority, $accepted_args ); 62 $hook->add_filter( $hook_name, $callback_two, $priority, $accepted_args ); 63 63 $hook->do_action( array( $arg ) ); 64 64 … … 73 73 $callback_two = array( $b, 'filter' ); 74 74 $hook = new WP_Hook(); 75 $ tag= __FUNCTION__;75 $hook_name = __FUNCTION__; 76 76 $priority = 1; 77 77 $accepted_args = 2; 78 78 $arg = __FUNCTION__ . '_arg'; 79 79 80 $hook->add_filter( $ tag, $callback_one, $priority, $accepted_args );81 $hook->add_filter( $ tag, $callback_two, $priority + 1, $accepted_args );80 $hook->add_filter( $hook_name, $callback_one, $priority, $accepted_args ); 81 $hook->add_filter( $hook_name, $callback_two, $priority + 1, $accepted_args ); 82 82 $hook->do_action( array( $arg ) ); 83 83 … … 89 89 $callback = array( $this, '_action_callback' ); 90 90 $hook = new WP_Hook(); 91 $ tag= __FUNCTION__;91 $hook_name = __FUNCTION__; 92 92 $priority = 1; 93 93 $accepted_args = 0; 94 94 $arg = __FUNCTION__ . '_arg'; 95 95 96 $hook->add_filter( $ tag, $callback, $priority, $accepted_args );96 $hook->add_filter( $hook_name, $callback, $priority, $accepted_args ); 97 97 $hook->do_action( array( $arg ) ); 98 98 … … 103 103 $callback = array( $this, '_action_callback' ); 104 104 $hook = new WP_Hook(); 105 $ tag= __FUNCTION__;105 $hook_name = __FUNCTION__; 106 106 $priority = 1; 107 107 $accepted_args = 1; 108 108 $arg = __FUNCTION__ . '_arg'; 109 109 110 $hook->add_filter( $ tag, $callback, $priority, $accepted_args );110 $hook->add_filter( $hook_name, $callback, $priority, $accepted_args ); 111 111 $hook->do_action( array( $arg ) ); 112 112 … … 117 117 $callback = array( $this, '_action_callback' ); 118 118 $hook = new WP_Hook(); 119 $ tag= __FUNCTION__;119 $hook_name = __FUNCTION__; 120 120 $priority = 100; 121 121 $accepted_args = 1000; 122 122 $arg = __FUNCTION__ . '_arg'; 123 123 124 $hook->add_filter( $ tag, $callback, $priority, $accepted_args );124 $hook->add_filter( $hook_name, $callback, $priority, $accepted_args ); 125 125 $hook->do_action( array( $arg ) ); 126 126
Note: See TracChangeset
for help on using the changeset viewer.