WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/19/2016 05:59:12 AM (4 years ago)
Author:
westonruter
Message:

Customize: Ensure WP_Customize_Setting::value() returns previewed value for custom types utilizing the customize_value_{$id_base} filter.

Fixes #38864.

File:
1 edited

Legend:

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

    r38810 r39318  
    396396        $this->assertEquals( $post_data_overrides[ $name ], $setting->value() );
    397397
     398        // Custom type that does not handle supplying the post value from the customize_value_{$id_base} filter.
     399        $setting_id = 'custom_without_previewing_value_filter';
     400        $setting = $this->manager->add_setting( $setting_id, array(
     401            'type' => 'custom_preview_test',
     402            'default' => 123,
     403            'sanitize_callback' => array( $this->manager->nav_menus, 'intval_base10' ),
     404        ) );
     405        $this->assertSame( 123, $setting->value() );
     406        $this->manager->set_post_value( $setting_id, '456' );
     407        $setting->preview();
     408        $this->assertSame( 456, $setting->value() );
     409
    398410        unset( $this->custom_type_data_previewed, $this->custom_type_data_saved );
    399411    }
Note: See TracChangeset for help on using the changeset viewer.