Customizer: Ensure `WP_Customize_Setting::update()` returns boolean value.

Adds unit tests for `WP_Customize_Setting::save()` (and `WP_Customize_Setting::update()`), along with the actions `customize_update_{$type}`, and `customize_save_{$id_base}` which they trigger.

Fixes #34140.

Built from https://develop.svn.wordpress.org/trunk@34838


git-svn-id: http://core.svn.wordpress.org/trunk@34803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2015-10-05 21:58:24 +00:00
parent 1e90e58da3
commit 0b93819465
2 changed files with 8 additions and 5 deletions

View File

@ -304,12 +304,13 @@ class WP_Customize_Setting {
* @since 3.4.0
*
* @param mixed $value The value to update.
* @return mixed The result of saving the value.
* @return bool The result of saving the value.
*/
protected function update( $value ) {
switch( $this->type ) {
switch ( $this->type ) {
case 'theme_mod' :
return $this->_update_theme_mod( $value );
$this->_update_theme_mod( $value );
return true;
case 'option' :
return $this->_update_option( $value );
@ -327,7 +328,9 @@ class WP_Customize_Setting {
* @param mixed $value Value of the setting.
* @param WP_Customize_Setting $this WP_Customize_Setting instance.
*/
return do_action( 'customize_update_' . $this->type, $value, $this );
do_action( "customize_update_{$this->type}", $value, $this );
return has_action( "customize_update_{$this->type}" );
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34837';
$wp_version = '4.4-alpha-34838';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.