Changeset 38763 for trunk/tests/phpunit/tests/actions.php
- Timestamp:
- 10/09/2016 01:29:04 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/actions.php
r38571 r38763 10 10 function test_simple_action() { 11 11 $a = new MockAction(); 12 $tag = 'test_action';12 $tag = __FUNCTION__; 13 13 14 14 add_action($tag, array(&$a, 'action')); … … 27 27 function test_remove_action() { 28 28 $a = new MockAction(); 29 $tag = rand_str();29 $tag = __FUNCTION__; 30 30 31 31 add_action($tag, array(&$a, 'action')); … … 45 45 46 46 function test_has_action() { 47 $tag = rand_str();48 $func = rand_str();47 $tag = __FUNCTION__; 48 $func = __FUNCTION__ . '_func'; 49 49 50 50 $this->assertFalse( has_action($tag, $func) ); … … 62 62 $a1 = new MockAction(); 63 63 $a2 = new MockAction(); 64 $tag = rand_str();64 $tag = __FUNCTION__; 65 65 66 66 // add both actions to the hook … … 77 77 function test_action_args_1() { 78 78 $a = new MockAction(); 79 $tag = rand_str();80 $val = rand_str();79 $tag = __FUNCTION__; 80 $val = __FUNCTION__ . '_val'; 81 81 82 82 add_action($tag, array(&$a, 'action')); … … 93 93 $a1 = new MockAction(); 94 94 $a2 = new MockAction(); 95 $tag = rand_str();96 $val1 = rand_str();97 $val2 = rand_str();95 $tag = __FUNCTION__; 96 $val1 = __FUNCTION__ . '_val1'; 97 $val2 = __FUNCTION__ . '_val2'; 98 98 99 99 // a1 accepts two arguments, a2 doesn't … … 126 126 $a2 = new MockAction(); 127 127 $a3 = new MockAction(); 128 $tag = rand_str();129 $val1 = rand_str();130 $val2 = rand_str();128 $tag = __FUNCTION__; 129 $val1 = __FUNCTION__ . '_val1'; 130 $val2 = __FUNCTION__ . '_val2'; 131 131 132 132 // a1 accepts two arguments, a2 doesn't, a3 accepts two arguments … … 156 156 function test_action_priority() { 157 157 $a = new MockAction(); 158 $tag = rand_str();158 $tag = __FUNCTION__; 159 159 160 160 add_action($tag, array(&$a, 'action'), 10); … … 205 205 function test_all_action() { 206 206 $a = new MockAction(); 207 $tag1 = rand_str();208 $tag2 = rand_str();207 $tag1 = __FUNCTION__ . '_1'; 208 $tag2 = __FUNCTION__ . '_2'; 209 209 210 210 // add an 'all' action … … 229 229 function test_remove_all_action() { 230 230 $a = new MockAction(); 231 $tag = rand_str();231 $tag = __FUNCTION__; 232 232 233 233 add_action('all', array(&$a, 'action')); … … 250 250 $obj = new stdClass(); 251 251 $a = new MockAction(); 252 $tag = rand_str();252 $tag = __FUNCTION__; 253 253 254 254 add_action($tag, array(&$a, 'action')); … … 269 269 $a = new MockAction(); 270 270 271 $tag = rand_str();271 $tag = __FUNCTION__; 272 272 273 273 add_action($tag, array(&$a, 'action')); 274 274 275 $context = array( rand_str() => rand_str());275 $context = array( 'key1' => 'val1' ); 276 276 do_action($tag, $context); 277 277 … … 279 279 $this->assertSame($args[0][0], $context); 280 280 281 $context2 = array( rand_str() => rand_str(), rand_str() => rand_str());281 $context2 = array( 'key2' => 'val2', 'key3' => 'val3' ); 282 282 do_action($tag, $context2); 283 283 … … 301 301 */ 302 302 function test_action_recursion() { 303 $tag = rand_str();303 $tag = __FUNCTION__; 304 304 $a = new MockAction(); 305 305 $b = new MockAction(); … … 328 328 */ 329 329 function test_action_callback_manipulation_while_running() { 330 $tag = rand_str();330 $tag = __FUNCTION__; 331 331 $a = new MockAction(); 332 332 $b = new MockAction(); … … 363 363 */ 364 364 function test_remove_anonymous_callback() { 365 $tag = rand_str();365 $tag = __FUNCTION__; 366 366 $a = new MockAction(); 367 367 add_action( $tag, array( $a, 'action' ), 12, 1 ); … … 397 397 function test_array_access_of_wp_filter_global() { 398 398 global $wp_filter; 399 $tag = rand_str();399 $tag = __FUNCTION__; 400 400 401 401 add_action( $tag, '__return_null', 11, 1 );
Note: See TracChangeset
for help on using the changeset viewer.