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