Ticket #27278: 27278.3.diff
File 27278.3.diff, 2.4 KB (added by , 11 years ago) |
---|
-
src/wp-includes/theme.php
1379 1379 * The init hook may be too late for some features. 1380 1380 * 1381 1381 * @since 2.9.0 1382 * 1382 1383 * @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 1383 1385 */ 1384 1386 function add_theme_support( $feature ) { 1385 1387 global $_wp_theme_features; … … 1397 1399 1398 1400 case 'html5' : 1399 1401 // You can't just pass 'html5', you need to pass an array of types. 1400 if ( empty( $args[0] ) ) { 1401 $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) ); 1402 } elseif ( ! is_array( $args[0] ) ) { 1402 // Note: as of 3.9.0 core supports the types 'comment-list', 'comment-form', 'search-form' and 'gallery' 1403 if ( ! is_array( $args[0] ) ) { 1403 1404 _doing_it_wrong( "add_theme_support( 'html5' )", 'You need to pass an array of types.', '3.6.1' ); 1404 1405 return false; 1405 1406 } -
tests/phpunit/tests/theme/support.php
80 80 81 81 /** 82 82 * @ticket 24932 83 * 84 * @expectedIncorrectUsage add_theme_support( 'html5' ) 83 85 */ 84 86 function test_supports_html5() { 85 87 remove_theme_support( 'html5' ); 86 88 $this->assertFalse( current_theme_supports( 'html5' ) ); 87 89 $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' ) ); 90 $this->assertFalse( add_theme_support( 'html5' ) ); 91 $this->assertFalse( current_theme_supports( 'html5' ) ); 92 $this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) ); 93 $this->assertFalse( current_theme_supports( 'html5', 'comment-list' ) ); 94 $this->assertFalse( current_theme_supports( 'html5', 'search-form' ) ); 95 $this->assertFalse( current_theme_supports( 'html5', 'gallery' ) ); 93 96 $this->assertFalse( current_theme_supports( 'html5', 'something-else' ) ); 94 97 } 95 98