Changeset 50996 for trunk/tests/phpunit/tests/customize/widgets.php
- Timestamp:
- 05/25/2021 08:38:04 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/widgets.php
r49108 r50996 26 26 27 27 add_theme_support( 'customize-selective-refresh-widgets' ); 28 add_action( 'widgets_init', array( $this, 'remove_widgets_block_editor' ) ); 28 29 $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 29 30 wp_set_current_user( $user_id ); … … 84 85 do_action( 'wp_loaded' ); 85 86 do_action( 'wp', $GLOBALS['wp'] ); 87 } 88 89 function remove_widgets_block_editor() { 90 remove_theme_support( 'widgets-block-editor' ); 86 91 } 87 92 … … 259 264 260 265 $default_args = array( 261 'type' => 'option', 262 'capability' => 'edit_theme_options', 263 'transport' => 'refresh', 264 'default' => array(), 265 'sanitize_callback' => array( $this->manager->widgets, 'sanitize_widget_instance' ), 266 'sanitize_js_callback' => array( $this->manager->widgets, 'sanitize_widget_js_instance' ), 266 'type' => 'option', 267 'capability' => 'edit_theme_options', 268 'transport' => 'refresh', 269 'default' => array(), 267 270 ); 268 271 $args = $this->manager->widgets->get_setting_args( 'widget_foo[2]' ); … … 270 273 $this->assertSame( $default_value, $args[ $key ] ); 271 274 } 275 $this->assertTrue( is_callable( $args['sanitize_callback'] ), 'sanitize_callback is callable' ); 276 $this->asserttrue( is_callable( $args['sanitize_js_callback'] ), 'sanitize_js_callback is callable' ); 272 277 $this->assertSame( 'WIDGET_FOO[2]', $args['uppercase_id_set_by_filter'] ); 273 278 274 279 $default_args = array( 275 'type' => 'option', 276 'capability' => 'edit_theme_options', 277 'transport' => 'postMessage', 278 'default' => array(), 279 'sanitize_callback' => array( $this->manager->widgets, 'sanitize_widget_instance' ), 280 'sanitize_js_callback' => array( $this->manager->widgets, 'sanitize_widget_js_instance' ), 280 'type' => 'option', 281 'capability' => 'edit_theme_options', 282 'transport' => 'postMessage', 283 'default' => array(), 281 284 ); 282 285 $args = $this->manager->widgets->get_setting_args( 'widget_search[2]' ); … … 284 287 $this->assertSame( $default_value, $args[ $key ] ); 285 288 } 289 $this->assertTrue( is_callable( $args['sanitize_callback'] ), 'sanitize_callback is callable' ); 290 $this->asserttrue( is_callable( $args['sanitize_js_callback'] ), 'sanitize_js_callback is callable' ); 286 291 287 292 remove_theme_support( 'customize-selective-refresh-widgets' ); … … 305 310 306 311 $default_args = array( 307 'type' => 'option', 308 'capability' => 'edit_theme_options', 309 'transport' => 'postMessage', 310 'default' => array(), 311 'sanitize_callback' => array( $this->manager->widgets, 'sanitize_sidebar_widgets' ), 312 'sanitize_js_callback' => array( $this->manager->widgets, 'sanitize_sidebar_widgets_js_instance' ), 312 'type' => 'option', 313 'capability' => 'edit_theme_options', 314 'transport' => 'postMessage', 315 'default' => array(), 313 316 ); 314 317 $args = $this->manager->widgets->get_setting_args( 'sidebars_widgets[sidebar-1]' ); … … 316 319 $this->assertSame( $default_value, $args[ $key ] ); 317 320 } 321 $this->assertTrue( is_callable( $args['sanitize_callback'] ), 'sanitize_callback is callable' ); 322 $this->asserttrue( is_callable( $args['sanitize_js_callback'] ), 'sanitize_js_callback is callable' ); 318 323 $this->assertSame( 'SIDEBARS_WIDGETS[SIDEBAR-1]', $args['uppercase_id_set_by_filter'] ); 319 324
Note: See TracChangeset
for help on using the changeset viewer.