Changeset 407 in tests for wp-testcase/test_actions.php
- Timestamp:
- 08/04/2011 08:38:26 PM (15 years ago)
- File:
-
- 1 edited
-
wp-testcase/test_actions.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_actions.php
r301 r407 39 39 40 40 } 41 41 42 42 function test_has_action() { 43 43 $tag = rand_str(); 44 44 $func = rand_str(); 45 45 46 46 $this->assertFalse( has_action($tag, $func) ); 47 47 $this->assertFalse( has_action($tag) ); … … 202 202 $a = new MockAction(); 203 203 $tags = array(rand_str(), rand_str(), rand_str(), rand_str(), rand_str()); 204 204 205 205 // two actions per tag 206 206 foreach ($tags as $tag) { … … 238 238 $this->assertFalse( empty($args[0][0]->foo) ); 239 239 } 240 240 241 241 function test_action_keyed_array() { 242 242 $this->knownWPBug(11241); … … 246 246 247 247 add_action($tag, array(&$a, 'action')); 248 248 249 249 $context = array( rand_str() => rand_str() ); 250 250 do_action($tag, $context); … … 258 258 $args = $a->get_args(); 259 259 $this->assertSame($args[1][0], $context2); 260 260 261 261 } 262 262 … … 270 270 271 271 $this->assertSame( 10, has_action($tag, $closure) ); 272 272 273 273 $context = array( rand_str(), rand_str() ); 274 274 do_action($tag, $context[0], $context[1]); 275 275 276 276 $this->assertSame($GLOBALS[$context[0]], $context[1]); 277 277 278 278 $tag2 = rand_str(); 279 279 $closure2 = function() { $GLOBALS['closure_no_args'] = true;}; … … 281 281 282 282 $this->assertSame( 10, has_action($tag2, $closure2) ); 283 283 284 284 do_action($tag2); 285 285 286 286 $this->assertTrue($GLOBALS['closure_no_args']); 287 287 288 288 } 289 289
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)