Make WordPress Core


Ignore:
Timestamp:
10/15/2013 02:30:02 PM (13 years ago)
Author:
nacin
Message:

Test runner: Add @expectedIncorrectUsage to trap _doing_it_wrong() calls.

see #24813, #25282.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/support.php

    r25387 r25785  
    55 */
    66class Tests_Theme_Support extends WP_UnitTestCase {
    7 
    8         function setUp() {
    9                 parent::setUp();
    10                 add_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) );
    11         }
    12 
    13         function tearDown() {
    14                 parent::tearDown();
    15                 remove_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) );
    16         }
    17 
    18         function doing_it_wrong_run( $function ) {
    19                 if ( in_array( $function, array( "add_theme_support( 'html5' )" ) ) )
    20                         add_filter( 'doing_it_wrong_trigger_error', array( $this, 'doing_it_wrong_trigger_error' ) );
    21         }
    22 
    23         function doing_it_wrong_trigger_error() {
    24                 remove_filter( 'doing_it_wrong_trigger_error', array( $this, 'doing_it_wrong_trigger_error' ) );
    25                 return false;
    26         }
    277
    288        function test_the_basics() {
    … …  
    11696        /**
    11797         * @ticket 24932
     98         *
     99         * @expectedIncorrectUsage add_theme_support( 'html5' )
    118100         */
    119101        function test_supports_html5_subset() {
    … …  
    145127        /**
    146128         * @ticket 24932
     129         *
     130         * @expectedIncorrectUsage add_theme_support( 'html5' )
    147131         */
    148132        function test_supports_html5_invalid() {
Note: See TracChangeset for help on using the changeset viewer.