WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/06/2016 05:58:28 AM (5 years ago)
Author:
westonruter
Message:

Customize: Ensure that WP_Customize_Setting::value() can return a previewed value for aggregated multidimensionals.

Fixes #37294.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/setting.php

    r37476 r37982  
    641641        return $validity;
    642642    }
     643
     644    /**
     645     * Ensure that WP_Customize_Setting::value() can return a previewed value for aggregated multidimensionals.
     646     *
     647     * @ticket 37294
     648     */
     649    public function test_multidimensional_value_when_previewed() {
     650        WP_Customize_Setting::reset_aggregated_multidimensionals();
     651
     652        $initial_value = 456;
     653        set_theme_mod( 'nav_menu_locations', array(
     654            'primary' => $initial_value,
     655        ) );
     656        $setting_id = 'nav_menu_locations[primary]';
     657
     658        $setting = new WP_Customize_Setting( $this->manager, $setting_id );
     659        $this->assertEquals( $initial_value, $setting->value() );
     660
     661        $override_value = -123456;
     662        $this->manager->set_post_value( $setting_id, $override_value );
     663        $setting->preview();
     664
     665        $this->assertEquals( $override_value, $setting->value() );
     666    }
    643667}
    644668
Note: See TracChangeset for help on using the changeset viewer.