1 | <?php |
---|
2 | /** |
---|
3 | * @group externals |
---|
4 | */ |
---|
5 | class Tests_Externals extends WP_UnitTestCase { |
---|
6 | |
---|
7 | function setUp() { |
---|
8 | parent::setUp(); |
---|
9 | } |
---|
10 | |
---|
11 | function tearDown() { |
---|
12 | parent::tearDown(); |
---|
13 | } |
---|
14 | /** |
---|
15 | * bug 7392, 23417 |
---|
16 | */ |
---|
17 | function test_dont_allow_deregister_core_scripts_in_admin() { |
---|
18 | //go into admin |
---|
19 | set_current_screen( 'edit.php' ); |
---|
20 | //verify in admin |
---|
21 | $this->assertEquals( true, is_admin() ) ; |
---|
22 | $this->assertEquals( true, 'admin_enqueue_scripts' !== current_filter() ); |
---|
23 | $checklibs = array( |
---|
24 | 'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion', |
---|
25 | 'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog', |
---|
26 | 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse', |
---|
27 | 'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable', |
---|
28 | 'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs', |
---|
29 | 'jquery-ui-tooltip', 'jquery-ui-widget', 'backbone', 'underscore', |
---|
30 | ); |
---|
31 | foreach ( $checklibs as $libtocheck ) { |
---|
32 | wp_enqueue_script( $libtocheck ); //queue script |
---|
33 | wp_deregister_script( $libtocheck ); //try to deregister script |
---|
34 | $this->assertEquals( true, wp_script_is( $libtocheck, 'registered' ) ) ; //not allowed! script should still be there |
---|
35 | } |
---|
36 | |
---|
37 | } |
---|
38 | } |
---|