Make WordPress Core

Ticket #27278: 27278.5.diff

File 27278.5.diff, 1.9 KB (added by jond3r, 11 years ago)

Per Sergey's suggestion, but adding @return-tag to doc block and updated unit tests

  • src/wp-includes/theme.php

     
    13791379 * The init hook may be too late for some features.
    13801380 *
    13811381 * @since 2.9.0
     1382 *
    13821383 * @param string $feature the feature being added
     1384 * @return void|bool False if trying to add html5 support and not passing an array as 2nd argument
    13831385 */
    13841386function add_theme_support( $feature ) {
    13851387        global $_wp_theme_features;
     
    13981400                case 'html5' :
    13991401                        // You can't just pass 'html5', you need to pass an array of types.
    14001402                        if ( empty( $args[0] ) ) {
    1401                                 $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );
     1403                                _doing_it_wrong( "add_theme_support( 'html5' )", 'You need to pass an array of types.', '3.6.1' );
     1404                                $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );   // Back compat
    14021405                        } elseif ( ! is_array( $args[0] ) ) {
    14031406                                _doing_it_wrong( "add_theme_support( 'html5' )", 'You need to pass an array of types.', '3.6.1' );
    14041407                                return false;
  • tests/phpunit/tests/theme/support.php

     
    8080
    8181        /**
    8282         * @ticket 24932
     83         *
     84         * @expectedIncorrectUsage add_theme_support( 'html5' )
    8385         */
    8486        function test_supports_html5() {
    8587                remove_theme_support( 'html5' );
     
    9092                $this->assertTrue( current_theme_supports( 'html5', 'comment-form' ) );
    9193                $this->assertTrue( current_theme_supports( 'html5', 'comment-list' ) );
    9294                $this->assertTrue( current_theme_supports( 'html5', 'search-form' ) );
     95                $this->assertFalse( current_theme_supports( 'html5', 'gallery' ) );
    9396                $this->assertFalse( current_theme_supports( 'html5', 'something-else' ) );
    9497        }
    9598