- Timestamp:
- 01/30/2018 02:55:25 PM (8 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tests/phpunit/tests/widgets/text-widget.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
- Property svn:mergeinfo changed
/trunk merged: 42613,42617
- Property svn:mergeinfo changed
-
branches/4.9/tests/phpunit/tests/widgets/text-widget.php
r41361 r42622 30 30 * Clean up global scope. 31 31 * 32 * @global WP_Scripts $wp_scripts 33 * @global WP_Styles $wp_style 32 * @global WP_Scripts $wp_scripts 33 * @global WP_Styles $wp_style 34 * @global WP_Customize_Manager $wp_customize 34 35 */ 35 36 function clean_up_global_scope() { 36 global $wp_scripts, $wp_styles ;37 global $wp_scripts, $wp_styles, $wp_customize; 37 38 parent::clean_up_global_scope(); 38 $wp_scripts = null; 39 $wp_styles = null; 39 $wp_scripts = null; 40 $wp_styles = null; 41 $wp_customize = null; 40 42 } 41 43 … … 67 69 $this->assertEquals( 10, has_action( 'admin_footer-widgets.php', array( 'WP_Widget_Text', 'render_control_template_scripts' ) ) ); 68 70 $this->assertContains( 'wp.textWidgets.idBases.push( "text" );', wp_scripts()->registered['text-widgets']->extra['after'] ); 71 $this->assertFalse( has_action( 'wp_enqueue_scripts', array( $widget, 'enqueue_preview_scripts' ) ) ); 72 } 73 74 /** 75 * Test register in customize preview. 76 * 77 * @global WP_Customize_Manager $wp_customize 78 * @covers WP_Widget_Text::__construct() 79 * @covers WP_Widget_Text::_register() 80 */ 81 function test__register_in_customize_preview() { 82 global $wp_customize; 83 wp_set_current_user( 84 $this->factory()->user->create( 85 array( 86 'role' => 'administrator', 87 ) 88 ) 89 ); 90 require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; 91 $wp_customize = new WP_Customize_Manager( 92 array( 93 'changeset_uuid' => wp_generate_uuid4(), 94 ) 95 ); 96 $wp_customize->start_previewing_theme(); 97 98 $widget = new WP_Widget_Text(); 99 $widget->_register(); 100 $this->assertEquals( 10, has_action( 'wp_enqueue_scripts', array( $widget, 'enqueue_preview_scripts' ) ) ); 101 } 102 103 /** 104 * Test enqueue_preview_scripts method. 105 * 106 * @global WP_Scripts $wp_scripts 107 * @global WP_Styles $wp_styles 108 * @covers WP_Widget_Text::enqueue_preview_scripts 109 */ 110 function test_enqueue_preview_scripts() { 111 global $wp_scripts, $wp_styles; 112 $wp_scripts = null; 113 $wp_styles = null; 114 $widget = new WP_Widget_Text(); 115 116 $this->assertFalse( wp_style_is( 'wp-mediaelement' ) ); 117 $this->assertFalse( wp_script_is( 'wp-playlist' ) ); 118 119 ob_start(); 120 $widget->enqueue_preview_scripts(); 121 ob_end_clean(); 122 123 $this->assertTrue( wp_style_is( 'wp-mediaelement' ) ); 124 $this->assertTrue( wp_script_is( 'wp-playlist' ) ); 69 125 } 70 126
Note: See TracChangeset
for help on using the changeset viewer.