Changeset 37588 for trunk/tests/phpunit/tests/actions.php
- Timestamp:
- 05/27/2016 07:19:12 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/actions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/actions.php
r27294 r37588 329 329 } 330 330 331 /** 332 * @ticket 36819 333 */ 334 function test_backup_plugin_globals_returns_filters() { 335 $backup = _backup_plugin_globals(); 336 $this->assertArrayHasKey( 'backup_wp_filter', $backup ); 337 $this->assertArrayHasKey( 'backup_wp_actions', $backup ); 338 $this->assertArrayHasKey( 'backup_wp_current_filter', $backup ); 339 $this->assertArrayHasKey( 'backup_merged_filters', $backup ); 340 } 341 342 /** 343 * @ticket 36819 344 */ 345 function test_backup_plugin_globals_returns_filters_from_first_time_called() { 346 $backup = _backup_plugin_globals(); 347 348 $a = new MockAction(); 349 $tag = rand_str(); 350 351 add_action($tag, array(&$a, 'action')); 352 353 $new_backup = _backup_plugin_globals(); 354 $this->assertEquals( $backup, $new_backup ); 355 } 356 357 /** 358 * @ticket 36819 359 */ 360 function test_restore_plugin_globals_from_stomp() { 361 global $wp_actions; 362 $original_actions = $wp_actions; 363 364 _backup_plugin_globals(); 365 366 $wp_actions = array(); 367 368 $this->assertEmpty( $wp_actions ); 369 _restore_plugin_globals(); 370 371 $this->assertEquals( $GLOBALS['wp_actions'], $original_actions ); 372 } 373 374 /** 375 * @ticket 36819 376 */ 377 function test_restore_plugin_globals_includes_additions() { 378 global $wp_filter; 379 $original_filter = $wp_filter; 380 381 $backup = _backup_plugin_globals(); 382 383 $a = new MockAction(); 384 $tag = rand_str(); 385 add_action($tag, array(&$a, 'action')); 386 387 $this->assertNotEquals( $GLOBALS['wp_filter'], $original_filter ); 388 389 _restore_plugin_globals(); 390 391 $this->assertNotEquals( $GLOBALS['wp_filter'], $original_filter ); 392 } 393 331 394 function apply_testing_filter() { 332 395 $this->apply_testing_filter = true;
Note: See TracChangeset
for help on using the changeset viewer.