Ticket #22896: 22896-unittest-2.diff

File 22896-unittest-2.diff, 1.4 KB (added by adamsilverstein, 3 months ago)

updated unit test for #22896

  • tests/dependencies/jquery.php

     
    66 */ 
    77class Tests_Dependencies_jQuery extends WP_UnitTestCase { 
    88 
     9        /** 
     10         * @ticket 22896  
     11         */ 
     12        function test_dont_allow_deregister_core_scripts_in_admin() { 
     13                set_current_screen( 'edit.php' ); //go into admin 
     14                $this->assertTrue( is_admin() ) ; //verify in admin 
     15                $checklibs = array( 
     16                        'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion', 
     17                        'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog', 
     18                        'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse', 
     19                        'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable', 
     20                        'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs', 
     21                        'jquery-ui-tooltip', 'jquery-ui-widget', 'backbone', 'underscore',  
     22                ); 
     23                foreach ( $checklibs as $libtocheck ) { 
     24                        wp_enqueue_script( $libtocheck ); //queue script 
     25                        wp_deregister_script( $libtocheck ); //try to deregister script 
     26                        $this->assertTrue( wp_script_is( $libtocheck, 'registered' ) ) ; //not allowed! script should still be there 
     27                } 
     28        } 
     29 
    930        function test_location_of_jquery() { 
    1031        $jquery_scripts = array( 
    1132            'jquery-core'    => '/wp-includes/js/jquery/jquery.js',