Changeset 37648
- Timestamp:
- 06/06/2016 09:50:29 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-widget.php
r37492 r37648 17 17 * @since 2.8.0 18 18 * @since 4.4.0 Moved to its own file from wp-includes/widgets.php 19 * @abstract20 19 */ 21 abstractclass WP_Widget {20 class WP_Widget { 22 21 23 22 /** … … 98 97 * @since 2.8.0 99 98 * @access public 100 * @abstract101 99 * 102 100 * @param array $args Display arguments including 'before_title', 'after_title', … … 104 102 * @param array $instance The settings for the particular instance of the widget. 105 103 */ 106 abstract public function widget( $args, $instance ); 104 public function widget( $args, $instance ) { 105 die('function WP_Widget::widget() must be over-ridden in a sub-class.'); 106 } 107 107 108 108 /** -
trunk/tests/phpunit/tests/widgets.php
r37427 r37648 337 337 */ 338 338 function test_wp_widget_form() { 339 $widget = new WP_Widget _Mock( 'foo', 'Foo' );339 $widget = new WP_Widget( '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 _Mock( $id_base, $name );353 $foo_widget = new WP_Widget( $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 _Mock( $id_base, $name, $widget_options, $control_options );371 $bar_widget = new WP_Widget( $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 _Mock( 'foo', 'Foo' );382 $widget = new WP_Widget( '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 _Mock( 'foo', 'Foo' );433 $widget = new WP_Widget( '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 _Mock( 'foo', 'Foo' );506 $widget = new WP_Widget( '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.0687 */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.