Make WordPress Core

Ticket #30017: customize-custom-css-setting.patch

File customize-custom-css-setting.patch, 1.5 KB (added by Frank Klein, 5 years ago)
  • tests/phpunit/tests/customize/custom-css-setting.php

    diff --git tests/phpunit/tests/customize/custom-css-setting.php tests/phpunit/tests/customize/custom-css-setting.php
    index 63f55364c3..ae74da5c28 100644
    class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase { 
    2323        public $setting;
    2424
    2525        /**
    26          * Set up the test case.
     26         * Administrator user id.
    2727         *
    28          * @see WP_UnitTestCase::setup()
     28         * @var int
    2929         */
    30         function setUp() {
    31                 parent::setUp();
     30        public static $user_id;
     31
     32        public static function wpSetUpBeforeClass() {
    3233                require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    3334
    34                 $user_id = self::factory()->user->create(
     35                self::$user_id = self::factory()->user->create(
    3536                        array(
    3637                                'role' => 'administrator',
    3738                        )
    3839                );
    3940                if ( is_multisite() ) {
    40                         grant_super_admin( $user_id );
     41                        grant_super_admin( self::$user_id );
    4142                }
     43        }
    4244
    43                 wp_set_current_user( $user_id );
     45        /**
     46         * Set up the test case.
     47         *
     48         * @see WP_UnitTestCase::setup()
     49         */
     50        function setUp() {
     51                parent::setUp();
    4452
    4553                global $wp_customize;
    4654                $this->wp_customize = new WP_Customize_Manager();
    class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase { 
    4957                do_action( 'customize_register', $this->wp_customize );
    5058                $this->setting = new WP_Customize_Custom_CSS_Setting( $this->wp_customize, 'custom_css[' . get_stylesheet() . ']' );
    5159                $this->wp_customize->add_setting( $this->setting );
     60
     61                wp_set_current_user( self::$user_id );
    5262        }
    5363
    5464        /**