Changeset 37350 for trunk/tests/phpunit/tests/customize/setting.php
- Timestamp:
- 05/02/2016 10:41:36 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/customize/setting.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/setting.php
r36622 r37350 278 278 } 279 279 280 function custom_type_value_filter( $default ) { 280 /** 281 * Filter for `customize_value_{$id_base}`. 282 * 283 * @param mixed $default 284 * @param WP_Customize_Setting $setting 285 * 286 * @return mixed|null 287 */ 288 function custom_type_value_filter( $default, $setting = null ) { 281 289 $name = preg_replace( '/^customize_value_/', '', current_filter() ); 290 $this->assertInstanceOf( 'WP_Customize_Setting', $setting ); 291 $id_data = $setting->id_data(); 292 $this->assertEquals( $name, $id_data['base'] ); 282 293 return $this->custom_type_getter( $name, $default ); 283 294 } … … 315 326 $setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) ); 316 327 // Note: #29316 will allow us to have one filter for all settings of a given type, which is what we need. 317 add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ) );328 add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ), 10, 2 ); 318 329 $this->assertEquals( $this->undefined, $this->custom_type_getter( $name, $this->undefined ) ); 319 330 $this->assertEquals( $default, $setting->value() ); … … 331 342 $setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) ); 332 343 // Note: #29316 will allow us to have one filter for all settings of a given type, which is what we need. 333 add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ) );344 add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ), 10, 2 ); 334 345 $this->assertEquals( $initial_value, $this->custom_type_getter( $name, $this->undefined ) ); 335 346 $this->assertEquals( $initial_value, $setting->value() ); … … 351 362 $setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) ); 352 363 // Note: #29316 will allow us to have one filter for all settings of a given type, which is what we need. 353 add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ) );364 add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ), 10, 2 ); 354 365 $this->assertEquals( $this->undefined, $this->custom_type_getter( $name, $this->undefined ) ); 355 366 $this->assertEquals( $default, $setting->value() ); … … 367 378 $setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) ); 368 379 // Note: #29316 will allow us to have one filter for all settings of a given type, which is what we need. 369 add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ) );380 add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ), 10, 2 ); 370 381 $this->assertEquals( $initial_value, $this->custom_type_getter( $name, $this->undefined ) ); 371 382 $this->assertEquals( $initial_value, $setting->value() );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)