Make WordPress Core

Changeset 495 in tests


Ignore:
Timestamp:
01/05/2012 06:30:06 PM (13 years ago)
Author:
ryan
Message:

Tests for pluggable arg checking in current_theme_supports()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_theme.php

    r435 r495  
    440440
    441441    }
     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    }
    442463}
    443464?>
Note: See TracChangeset for help on using the changeset viewer.