Ticket #36952: 36952.2.diff
File 36952.2.diff, 2.0 KB (added by , 8 years ago) |
---|
-
src/wp-includes/class-wp-customize-setting.php
587 587 $id_base = $this->id_data['base']; 588 588 if ( 'option' === $this->type ) { 589 589 return get_option( $id_base, $default ); 590 } else if ( 'theme_mod') {590 } elseif ( 'theme_mod' === $this->type ) { 591 591 return get_theme_mod( $id_base, $default ); 592 592 } else { 593 593 /* … … 616 616 $autoload = self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload']; 617 617 } 618 618 return update_option( $id_base, $value, $autoload ); 619 } else if ( 'theme_mod') {619 } elseif ( 'theme_mod' === $this->type ) { 620 620 set_theme_mod( $id_base, $value ); 621 621 return true; 622 622 } else { -
tests/phpunit/tests/customize/setting.php
397 397 398 398 // Custom type that does not handle supplying the post value from the customize_value_{$id_base} filter. 399 399 $setting_id = 'custom_without_previewing_value_filter'; 400 400 401 $setting = $this->manager->add_setting( $setting_id, array( 401 402 'type' => 'custom_preview_test', 402 403 'default' => 123, 403 404 'sanitize_callback' => array( $this->manager->nav_menus, 'intval_base10' ), 404 405 ) ); 406 407 // When #36952 occurs, get_theme_mod() will still return the default 408 // value if no theme mod exists. Add one to test that it isn't returned. 409 set_theme_mod( $setting_id, 999 ); 405 410 $this->assertSame( 123, $setting->value() ); 411 406 412 $this->manager->set_post_value( $setting_id, '456' ); 407 413 $setting->preview(); 408 414 $this->assertSame( 456, $setting->value() ); 409 415 410 416 unset( $this->custom_type_data_previewed, $this->custom_type_data_saved ); 417 remove_theme_mod( $setting_id ); 411 418 } 412 419 413 420 /**