WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/15/2013 02:30:02 PM (8 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/dependencies/jquery.php

    r25375 r25785  
    3939    /**
    4040     * @ticket 22896
     41     *
     42     * @expectedIncorrectUsage wp_deregister_script
    4143     */
    4244    function test_dont_allow_deregister_core_scripts_in_admin() {
     
    5254        );
    5355
    54         add_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) );
    55 
    5656        foreach ( $libraries as $library ) {
    5757            // Try to deregister the script, which should fail.
     
    6060        }
    6161
    62         remove_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) );
    63 
    6462        set_current_screen( 'front' );
    65     }
    66 
    67     function doing_it_wrong_run() {
    68         add_filter( 'doing_it_wrong_trigger_error', array( $this, 'doing_it_wrong_trigger_error' ) );
    69     }
    70 
    71     function doing_it_wrong_trigger_error() {
    72         remove_filter( 'doing_it_wrong_trigger_error', array( $this, 'doing_it_wrong_trigger_error' ) );
    73         return false;
    7463    }
    7564
Note: See TracChangeset for help on using the changeset viewer.