| | 9 | /** |
| | 10 | * @ticket 22896 |
| | 11 | */ |
| | 12 | function test_dont_allow_deregister_core_scripts_in_admin() { |
| | 13 | $current_screen = get_current_screen(); |
| | 14 | set_current_screen( 'edit.php' ); //go into admin |
| | 15 | $this->assertTrue( is_admin() ) ; //verify in admin |
| | 16 | $checklibs = array( |
| | 17 | 'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion', |
| | 18 | 'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog', |
| | 19 | 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse', |
| | 20 | 'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable', |
| | 21 | 'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs', |
| | 22 | 'jquery-ui-tooltip', 'jquery-ui-widget', 'backbone', 'underscore', |
| | 23 | ); |
| | 24 | foreach ( $checklibs as $libtocheck ) { |
| | 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 | set_current_screen( $current_screen ); |
| | 29 | } |
| | 30 | |