[wp-trac] [WordPress Trac] #51657: Correct displaying the _doing_it_wrong() message for add_theme_support( 'html5' )

WordPress Trac noreply at wordpress.org
Thu Feb 18 03:52:51 UTC 2021


#51657: Correct displaying the _doing_it_wrong() message for add_theme_support(
'html5' )
-------------------------------------------------+-------------------------
 Reporter:  SergeyBiryukov                       |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  5.7
Component:  Themes                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-screenshots has-patch needs-     |     Focuses:
  dev-note needs-refresh needs-unit-tests        |
-------------------------------------------------+-------------------------
Changes (by peterwilsoncc):

 * keywords:  has-screenshots has-patch needs-dev-note =>
     has-screenshots has-patch needs-dev-note needs-refresh needs-unit-
     tests


Comment:

 Reviewing [attachment:"51657.diff"] :

 * The condition can be reduced to `if ( empty( $args[0] ) || ! is_array(
 $args[0] ) )` -- `empty()` is a short cut for `! isset($var) || ! $var`.
 * I haven't run the full test suite but I am getting a few failures in
 `Tests_Theme_Support`
 * Some additional tests to make sure the feature is throwing a doing it
 wrong as expected would be ideal too


 {{{
 > phpunit --filter Tests_Theme_Support

 .....FFF....                                                      12 / 12
 (100%)

 There were 3 failures:

 1) Tests_Theme_Support::test_supports_html5
 Unexpected incorrect usage notice for add_theme_support( 'html5' )
 Failed asserting that an array is empty.

 /vagrant/wordpress-develop/tests/phpunit/includes/abstract-
 testcase.php:516
 /vagrant/wordpress-develop/tests/phpunit/includes/abstract-
 testcase.php:528

 2) Tests_Theme_Support::test_supports_html5_subset
 Failed asserting that null is false.

 /vagrant/wordpress-develop/tests/phpunit/tests/theme/support.php:101

 3) Tests_Theme_Support::test_supports_html5_invalid
 Failed asserting that null is false.

 /vagrant/wordpress-develop/tests/phpunit/tests/theme/support.php:130

 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51657#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list