WordPress.org

Make WordPress Core

Changeset 38850


Ignore:
Timestamp:
10/21/2016 05:27:56 AM (19 months ago)
Author:
pento
Message:

Tests: Prevent Twenty Seventeen from interfering with Customizer tests.

This was previously fixed in [38837], but it wasn't really the correct answer, to fix it in the theme. So, [38837] is reverted in this commit, and the Twenty Seventeen actions causing problems are unhooked before tests are run.

See #38372.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/inc/customizer.php

    r38841 r38850  
    1414 */
    1515function twentyseventeen_customize_register( $wp_customize ) {
    16     $postMessage_settings = array( 'blogname', 'blogdescription', 'header_textcolor' );
    17     foreach( $postMessage_settings as $postMessage_setting ) {
    18         $setting = $wp_customize->get_setting( $postMessage_setting );
    19         if ( $setting ) {
    20             $setting->transport = 'postMessage';
    21         }
    22     }
     16    $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
     17    $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
     18    $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
    2319
    2420    /**
  • trunk/tests/phpunit/tests/customize/control.php

    r36689 r38850  
    3232        // @codingStandardsIgnoreEnd
    3333        $this->wp_customize = $GLOBALS['wp_customize'];
     34
     35        // Remove default theme actions that interfere with tests
     36        remove_action( 'customize_register', 'twentyseventeen_customize_register' );
    3437    }
    3538
  • trunk/tests/phpunit/tests/customize/custom-css-setting.php

    r38829 r38850  
    3737        $wp_customize = $this->wp_customize;
    3838
     39        // Remove default theme actions that interfere with tests
     40        remove_action( 'customize_register', 'twentyseventeen_customize_register' );
     41
    3942        do_action( 'customize_register', $this->wp_customize );
    4043        $this->setting = new WP_Customize_Custom_CSS_Setting( $this->wp_customize, 'custom_css[twentysixteen]' );
  • trunk/tests/phpunit/tests/customize/manager.php

    r38830 r38850  
    5959        $this->manager = $this->instantiate();
    6060        $this->undefined = new stdClass();
     61
     62        // Remove default theme actions that interfere with tests
     63        remove_action( 'customize_register', 'twentyseventeen_customize_register' );
    6164    }
    6265
  • trunk/tests/phpunit/tests/customize/nav-menu-item-setting.php

    r38618 r38850  
    2727        $this->wp_customize = new WP_Customize_Manager();
    2828        $wp_customize = $this->wp_customize;
     29
     30        // Remove default theme actions that interfere with tests
     31        remove_action( 'customize_register', 'twentyseventeen_customize_register' );
    2932    }
    3033
  • trunk/tests/phpunit/tests/customize/nav-menu-setting.php

    r36622 r38850  
    2828        $this->wp_customize = new WP_Customize_Manager();
    2929        $wp_customize = $this->wp_customize;
     30
     31        // Remove default theme actions that interfere with tests
     32        remove_action( 'customize_register', 'twentyseventeen_customize_register' );
    3033    }
    3134
  • trunk/tests/phpunit/tests/customize/nav-menus.php

    r38436 r38850  
    2727        $this->wp_customize = new WP_Customize_Manager();
    2828        $wp_customize = $this->wp_customize;
     29
     30        // Remove default theme actions that interfere with tests
     31        remove_action( 'customize_register', 'twentyseventeen_customize_register' );
    2932    }
    3033
  • trunk/tests/phpunit/tests/customize/partial.php

    r36801 r38850  
    4040            $this->selective_refresh = $this->wp_customize->selective_refresh;
    4141        }
     42
     43        // Remove default theme actions that interfere with tests
     44        remove_action( 'customize_register', 'twentyseventeen_customize_register' );
    4245    }
    4346
  • trunk/tests/phpunit/tests/customize/selective-refresh.php

    r36643 r38850  
    4040            $this->selective_refresh = $this->wp_customize->selective_refresh;
    4141        }
     42
     43        // Remove default theme actions that interfere with tests
     44        remove_action( 'customize_register', 'twentyseventeen_customize_register' );
    4245    }
    4346
  • trunk/tests/phpunit/tests/customize/widgets.php

    r38838 r38850  
    4646        remove_action( 'customize_register', 'twentysixteen_customize_register', 11 );
    4747        remove_action( 'after_setup_theme', 'twentyseventeen_setup' );
     48        remove_action( 'customize_register', 'twentyseventeen_customize_register' );
    4849
    4950        $this->backup_registered_sidebars = $GLOBALS['wp_registered_sidebars'];
Note: See TracChangeset for help on using the changeset viewer.