Skip to content

Commit fe55855

Browse files
committed
Tests: Restore theme support after Customizer widget tests.
Save and restore theme features around each Customizer widget test so selective-refresh and block-editor support changes do not leak into later tests. Developed in: #13907 Props adrianmoldovanwp. See #65893. git-svn-id: https://develop.svn.wordpress.org/trunk@64061 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6a66b37 commit fe55855

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎tests/phpunit/tests/customize/widgets.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
2020
*/
2121
protected $backup_registered_sidebars;
2222

23+
/**
24+
* Theme support state before the test runs.
25+
*
26+
* @var array
27+
*/
28+
protected $backup_theme_features;
29+
2330
/**
2431
* ID of the administrator user.
2532
*
@@ -40,6 +47,7 @@ public function set_up() {
4047
parent::set_up();
4148
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
4249

50+
$this->backup_theme_features = $GLOBALS['_wp_theme_features'];
4351
add_theme_support( 'customize-selective-refresh-widgets' );
4452
add_action( 'widgets_init', array( $this, 'remove_widgets_block_editor' ) );
4553

@@ -110,6 +118,7 @@ public function tear_down() {
110118
unset( $GLOBALS['wp_customize'] );
111119
unset( $GLOBALS['wp_scripts'] );
112120
$GLOBALS['wp_registered_sidebars'] = $this->backup_registered_sidebars;
121+
$GLOBALS['_wp_theme_features'] = $this->backup_theme_features;
113122
parent::tear_down();
114123
}
115124

0 commit comments

Comments
 (0)