Make WordPress Core

Ticket #24932: 24932.3.diff

File 24932.3.diff, 3.5 KB (added by nacin, 11 years ago)
  • tests/phpunit/tests/theme/support.php

     
    8585                remove_theme_support( 'html5' );
    8686                $this->assertFalse( current_theme_supports( 'html5' ) );
    8787                $this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
    88                 $this->assertFalse( add_theme_support( 'html5' ) );
    89                 $this->assertFalse( current_theme_supports( 'html5' ) );
    90                 $this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
     88                $this->assertNotSame( false, add_theme_support( 'html5' ) );
     89                $this->assertTrue( current_theme_supports( 'html5' ) );
     90                $this->assertTrue( current_theme_supports( 'html5', 'comment-form' ) );
     91                $this->assertTrue( current_theme_supports( 'html5', 'comment-list' ) );
     92                $this->assertTrue( current_theme_supports( 'html5', 'search-form' ) );
     93                $this->assertFalse( current_theme_supports( 'html5', 'something-else' ) );
    9194        }
    9295
    9396        /**
     
    106109                $this->assertTrue( current_theme_supports( 'html5' ) );
    107110
    108111                // It appends, rather than replaces.
    109                 $this->assertFalse( current_theme_supports( 'html5', 'comments-list' ) );
    110                 $this->assertNotSame( false, add_theme_support( 'html5', array( 'comments-list' ) ) );
     112                $this->assertFalse( current_theme_supports( 'html5', 'comment-list' ) );
     113                $this->assertNotSame( false, add_theme_support( 'html5', array( 'comment-list' ) ) );
    111114                $this->assertTrue( current_theme_supports( 'html5', 'comment-form' ) );
    112                 $this->assertTrue( current_theme_supports( 'html5', 'comments-list' ) );
     115                $this->assertTrue( current_theme_supports( 'html5', 'comment-list' ) );
    113116                $this->assertFalse( current_theme_supports( 'html5', 'search-form' ) );
    114117
    115118                // Removal is all or nothing.
    116119                $this->assertTrue( remove_theme_support( 'html5' ) );
    117                 $this->assertFalse( current_theme_supports( 'html5', 'comments-list' ) );
    118                 $this->assertFalse( current_theme_supports( 'html5', 'comments-form' ) );
     120                $this->assertFalse( current_theme_supports( 'html5', 'comment-list' ) );
     121                $this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
    119122                $this->assertFalse( current_theme_supports( 'html5', 'search-form' ) );
    120123        }
    121124
     125        /**
     126         * @ticket 24932
     127         */
     128        function test_supports_html5_invalid() {
     129                remove_theme_support( 'html5' );
     130                $this->assertFalse( add_theme_support( 'html5', 'comment-form' ) );
     131                $this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
     132                $this->assertFalse( current_theme_supports( 'html5' ) );
     133        }
     134
    122135        function supports_foobar( $yesno, $args, $feature ) {
    123136                if ( $args[0] == $feature[0] )
    124137                        return true;
  • src/wp-includes/theme.php

     
    12731273
    12741274                case 'html5' :
    12751275                        // You can't just pass 'html5', you need to pass an array of types.
    1276                         if ( ! is_array( $args[0] ) )
     1276                        if ( empty( $args[0] ) ) {
     1277                                _doing_it_wrong( "add_theme_support( 'html5' )", 'You need to pass an array of types.', '3.6.1' );
     1278                                $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );
     1279                        } elseif ( ! is_array( $args[0] ) ) {
     1280                                _doing_it_wrong( "add_theme_support( 'html5' )", 'You need to pass an array of types.', '3.6.1' );
    12771281                                return false;
     1282                        }
    12781283
    12791284                        // Calling 'html5' again merges, rather than overwrites.
    12801285                        if ( isset( $_wp_theme_features['html5'] ) )