diff --git a/src/wp-content/themes/twentyseventeen/inc/customizer.php b/src/wp-content/themes/twentyseventeen/inc/customizer.php index 4ad8cd8be4..e2566507a0 100644 --- a/src/wp-content/themes/twentyseventeen/inc/customizer.php +++ b/src/wp-content/themes/twentyseventeen/inc/customizer.php @@ -13,13 +13,9 @@ * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function twentyseventeen_customize_register( $wp_customize ) { - $postMessage_settings = array( 'blogname', 'blogdescription', 'header_textcolor' ); - foreach( $postMessage_settings as $postMessage_setting ) { - $setting = $wp_customize->get_setting( $postMessage_setting ); - if ( $setting ) { - $setting->transport = 'postMessage'; - } - } + $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; + $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; + $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; /** * Custom colors. diff --git a/tests/phpunit/tests/customize/control.php b/tests/phpunit/tests/customize/control.php index e6d1141219..276939327e 100644 --- a/tests/phpunit/tests/customize/control.php +++ b/tests/phpunit/tests/customize/control.php @@ -31,6 +31,9 @@ class Test_WP_Customize_Control extends WP_UnitTestCase { $GLOBALS['wp_customize'] = new WP_Customize_Manager(); // @codingStandardsIgnoreEnd $this->wp_customize = $GLOBALS['wp_customize']; + + // Remove default theme actions that interfere with tests + remove_action( 'customize_register', 'twentyseventeen_customize_register' ); } /** diff --git a/tests/phpunit/tests/customize/custom-css-setting.php b/tests/phpunit/tests/customize/custom-css-setting.php index 4c98012626..a74fe7039e 100644 --- a/tests/phpunit/tests/customize/custom-css-setting.php +++ b/tests/phpunit/tests/customize/custom-css-setting.php @@ -36,6 +36,9 @@ class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase { $this->wp_customize = new WP_Customize_Manager(); $wp_customize = $this->wp_customize; + // Remove default theme actions that interfere with tests + remove_action( 'customize_register', 'twentyseventeen_customize_register' ); + do_action( 'customize_register', $this->wp_customize ); $this->setting = new WP_Customize_Custom_CSS_Setting( $this->wp_customize, 'custom_css[twentysixteen]' ); $this->wp_customize->add_setting( $this->setting ); diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index 3016c70f0b..d050285ff3 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -58,6 +58,9 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase { require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' ); $this->manager = $this->instantiate(); $this->undefined = new stdClass(); + + // Remove default theme actions that interfere with tests + remove_action( 'customize_register', 'twentyseventeen_customize_register' ); } /** diff --git a/tests/phpunit/tests/customize/nav-menu-item-setting.php b/tests/phpunit/tests/customize/nav-menu-item-setting.php index ebb9748fa3..66723ad3fe 100644 --- a/tests/phpunit/tests/customize/nav-menu-item-setting.php +++ b/tests/phpunit/tests/customize/nav-menu-item-setting.php @@ -26,6 +26,9 @@ class Test_WP_Customize_Nav_Menu_Item_Setting extends WP_UnitTestCase { global $wp_customize; $this->wp_customize = new WP_Customize_Manager(); $wp_customize = $this->wp_customize; + + // Remove default theme actions that interfere with tests + remove_action( 'customize_register', 'twentyseventeen_customize_register' ); } /** diff --git a/tests/phpunit/tests/customize/nav-menu-setting.php b/tests/phpunit/tests/customize/nav-menu-setting.php index 81e3e74960..ff2c4cb63d 100644 --- a/tests/phpunit/tests/customize/nav-menu-setting.php +++ b/tests/phpunit/tests/customize/nav-menu-setting.php @@ -27,6 +27,9 @@ class Test_WP_Customize_Nav_Menu_Setting extends WP_UnitTestCase { global $wp_customize; $this->wp_customize = new WP_Customize_Manager(); $wp_customize = $this->wp_customize; + + // Remove default theme actions that interfere with tests + remove_action( 'customize_register', 'twentyseventeen_customize_register' ); } /** diff --git a/tests/phpunit/tests/customize/nav-menus.php b/tests/phpunit/tests/customize/nav-menus.php index 06e2333be3..3fbe6f0b82 100644 --- a/tests/phpunit/tests/customize/nav-menus.php +++ b/tests/phpunit/tests/customize/nav-menus.php @@ -26,6 +26,9 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase { global $wp_customize; $this->wp_customize = new WP_Customize_Manager(); $wp_customize = $this->wp_customize; + + // Remove default theme actions that interfere with tests + remove_action( 'customize_register', 'twentyseventeen_customize_register' ); } /** diff --git a/tests/phpunit/tests/customize/partial.php b/tests/phpunit/tests/customize/partial.php index 944cb4e2b7..57f3c59dc0 100644 --- a/tests/phpunit/tests/customize/partial.php +++ b/tests/phpunit/tests/customize/partial.php @@ -39,6 +39,9 @@ class Test_WP_Customize_Partial extends WP_UnitTestCase { if ( isset( $this->wp_customize->selective_refresh ) ) { $this->selective_refresh = $this->wp_customize->selective_refresh; } + + // Remove default theme actions that interfere with tests + remove_action( 'customize_register', 'twentyseventeen_customize_register' ); } /** diff --git a/tests/phpunit/tests/customize/selective-refresh.php b/tests/phpunit/tests/customize/selective-refresh.php index 73e7dc36eb..d5557dd9a8 100644 --- a/tests/phpunit/tests/customize/selective-refresh.php +++ b/tests/phpunit/tests/customize/selective-refresh.php @@ -39,6 +39,9 @@ class Test_WP_Customize_Selective_Refresh extends WP_UnitTestCase { if ( isset( $this->wp_customize->selective_refresh ) ) { $this->selective_refresh = $this->wp_customize->selective_refresh; } + + // Remove default theme actions that interfere with tests + remove_action( 'customize_register', 'twentyseventeen_customize_register' ); } /** diff --git a/tests/phpunit/tests/customize/widgets.php b/tests/phpunit/tests/customize/widgets.php index 310320b18c..7d395c558e 100644 --- a/tests/phpunit/tests/customize/widgets.php +++ b/tests/phpunit/tests/customize/widgets.php @@ -45,6 +45,7 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase { remove_action( 'after_setup_theme', 'twentysixteen_setup' ); remove_action( 'customize_register', 'twentysixteen_customize_register', 11 ); remove_action( 'after_setup_theme', 'twentyseventeen_setup' ); + remove_action( 'customize_register', 'twentyseventeen_customize_register' ); $this->backup_registered_sidebars = $GLOBALS['wp_registered_sidebars'];