Changeset 34563 for trunk/tests/phpunit/tests/widgets.php
- Timestamp:
- 09/25/2015 09:01:46 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/widgets.php
r34465 r34563 307 307 $result = dynamic_sidebar( 'Sidebar 1' ); 308 308 ob_end_clean(); 309 309 310 310 $this->assertFalse( $result ); 311 311 } 312 312 313 /** 314 * @see wp_widget_control() 315 */ 316 function test_wp_widget_control() { 317 global $wp_registered_widgets; 318 319 wp_widgets_init(); 320 require_once ABSPATH . '/wp-admin/includes/widgets.php'; 321 $widget_id = 'search-2'; 322 $widget = $wp_registered_widgets[ $widget_id ]; 323 $params = array( 324 'widget_id' => $widget['id'], 325 'widget_name' => $widget['name'], 326 ); 327 $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $params, 1 => $widget['params'][0] ) ); 328 329 ob_start(); 330 call_user_func_array( 'wp_widget_control', $args ); 331 $control = ob_get_clean(); 332 $this->assertNotEmpty( $control ); 333 334 $this->assertContains( '<div class="widget-top">', $control ); 335 $this->assertContains( '<div class="widget-title-action">', $control ); 336 $this->assertContains( '<div class="widget-title">', $control ); 337 $this->assertContains( '<form method="post">', $control ); 338 $this->assertContains( '<div class="widget-content">', $control ); 339 $this->assertContains( '<input class="widefat"', $control ); 340 $this->assertContains( '<input type="hidden" name="id_base" class="id_base" value="search"', $control ); 341 $this->assertContains( '<div class="widget-control-actions">', $control ); 342 $this->assertContains( '<div class="alignleft">', $control ); 343 $this->assertContains( 'widget-control-remove', $control ); 344 $this->assertContains( 'widget-control-close', $control ); 345 $this->assertContains( '<div class="alignright">', $control ); 346 $this->assertContains( '<input type="submit" name="savewidget"', $control ); 347 348 $param_overrides = array( 349 'before_form' => '<!-- before_form -->', 350 'after_form' => '<!-- after_form -->', 351 'before_widget_content' => '<!-- before_widget_content -->', 352 'after_widget_content' => '<!-- after_widget_content -->', 353 ); 354 $params = array_merge( $params, $param_overrides ); 355 $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $params, 1 => $widget['params'][0] ) ); 356 357 ob_start(); 358 call_user_func_array( 'wp_widget_control', $args ); 359 $control = ob_get_clean(); 360 $this->assertNotEmpty( $control ); 361 $this->assertNotContains( '<form method="post">', $control ); 362 $this->assertNotContains( '<div class="widget-content">', $control ); 363 364 foreach ( $param_overrides as $contained ) { 365 $this->assertContains( $contained, $control ); 366 } 367 } 313 368 }
Note: See TracChangeset
for help on using the changeset viewer.