<?php
/**
 * @group externals
 */
class Tests_Externals extends WP_UnitTestCase {

	 function setUp() {
		parent::setUp();
	}

	function tearDown() {
		parent::tearDown();
	}
/**
 * bug 7392, 23417
 */
	function test_dont_allow_deregister_core_scripts_in_admin() {
		//go into admin
		set_current_screen( 'edit.php' );
		//verify in admin
		$this->assertEquals( true, is_admin() ) ;
		$this->assertEquals( true, 'admin_enqueue_scripts' !== current_filter() );
		$checklibs = array(
			'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion',
			'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog',
			'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse',
			'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable',
			'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs',
			'jquery-ui-tooltip', 'jquery-ui-widget', 'backbone', 'underscore',
		);
		foreach ( $checklibs as $libtocheck ) {
			wp_enqueue_script( $libtocheck ); //queue script
			wp_deregister_script( $libtocheck ); //try to deregister script
			$this->assertEquals( true, wp_script_is( $libtocheck, 'registered' ) ) ; //not allowed! script should still be there
		}

	}
}