Changeset 37427
- Timestamp:
- 05/12/2016 09:24:18 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/widgets.php
r37344 r37427 337 337 */ 338 338 function test_wp_widget_form() { 339 $widget = new WP_Widget ( 'foo', 'Foo' );339 $widget = new WP_Widget_Mock( 'foo', 'Foo' ); 340 340 ob_start(); 341 341 $retval = $widget->form( array() ); … … 351 351 $id_base = 'foo'; 352 352 $name = 'Foo'; 353 $foo_widget = new WP_Widget ( $id_base, $name );353 $foo_widget = new WP_Widget_Mock( $id_base, $name ); 354 354 355 355 $this->assertEquals( $id_base, $foo_widget->id_base ); … … 369 369 'id_base' => 'bar_id_base', 370 370 ); 371 $bar_widget = new WP_Widget ( $id_base, $name, $widget_options, $control_options );371 $bar_widget = new WP_Widget_Mock( $id_base, $name, $widget_options, $control_options ); 372 372 $this->assertEquals( $widget_options['classname'], $bar_widget->widget_options['classname'] ); 373 373 $this->assertEquals( $control_options['id_base'], $bar_widget->control_options['id_base'] ); … … 380 380 */ 381 381 function test_wp_widget_get_field_name( $expected, $value_to_test ) { 382 $widget = new WP_Widget ( 'foo', 'Foo' );382 $widget = new WP_Widget_Mock( 'foo', 'Foo' ); 383 383 $widget->_set( 2 ); 384 384 $this->assertEquals( $expected, $widget->get_field_name( $value_to_test ) ); … … 431 431 */ 432 432 function test_wp_widget_get_field_id( $expected, $value_to_test ) { 433 $widget = new WP_Widget ( 'foo', 'Foo' );433 $widget = new WP_Widget_Mock( 'foo', 'Foo' ); 434 434 $widget->_set( 2 ); 435 435 $this->assertEquals( $expected, $widget->get_field_id( $value_to_test ) ); … … 504 504 global $wp_customize; 505 505 506 $widget = new WP_Widget ( 'foo', 'Foo' );506 $widget = new WP_Widget_Mock( 'foo', 'Foo' ); 507 507 508 508 $this->assertEmpty( $wp_customize ); … … 680 680 681 681 } 682 683 /** 684 * Mock of WP_Widget. 685 * 686 * @since 4.6.0 687 */ 688 class WP_Widget_Mock extends WP_Widget { 689 public function widget( $args, $instance ) { 690 return; 691 } 692 };
Note: See TracChangeset
for help on using the changeset viewer.