| | 442 | |
| | 443 | function supports_foobar( $yesno, $args, $feature ) { |
| | 444 | if ( $args[0] == $feature[0] ) |
| | 445 | return true; |
| | 446 | return false; |
| | 447 | } |
| | 448 | |
| | 449 | function test_plugin_hook() { |
| | 450 | $this->assertFalse( current_theme_supports( 'foobar' ) ); |
| | 451 | add_theme_support( 'foobar' ); |
| | 452 | $this->assertTrue( current_theme_supports( 'foobar' ) ); |
| | 453 | |
| | 454 | add_filter( 'current_theme_supports-foobar', array( $this, 'supports_foobar'), 10, 3 ); |
| | 455 | |
| | 456 | add_theme_support( 'foobar', 'bar' ); |
| | 457 | $this->assertFalse( current_theme_supports( 'foobar', 'foo' ) ); |
| | 458 | $this->assertTrue( current_theme_supports( 'foobar', 'bar' ) ); |
| | 459 | |
| | 460 | remove_theme_support( 'foobar' ); |
| | 461 | $this->assertFalse( current_theme_supports( 'foobar', 'bar' ) ); |
| | 462 | } |