Make WordPress Core


Ignore:
Timestamp:
06/06/2016 09:50:29 PM (10 years ago)
Author:
ocean90
Message:

Widgets: Revert [37425] and [37427].

The change can cause fatal errors under certain conditions, like when the subclass has a different function signature for widget() or doesn't even implement the method.

See #35981.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/widgets.php

    r37427 r37648  
    337337         */
    338338        function test_wp_widget_form() {
    339                 $widget = new WP_Widget_Mock( 'foo', 'Foo' );
     339                $widget = new WP_Widget( 'foo', 'Foo' );
    340340                ob_start();
    341341                $retval = $widget->form( array() );
    … …  
    351351                $id_base = 'foo';
    352352                $name = 'Foo';
    353                 $foo_widget = new WP_Widget_Mock( $id_base, $name );
     353                $foo_widget = new WP_Widget( $id_base, $name );
    354354
    355355                $this->assertEquals( $id_base, $foo_widget->id_base );
    … …  
    369369                        'id_base' => 'bar_id_base',
    370370                );
    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 );
    372372                $this->assertEquals( $widget_options['classname'], $bar_widget->widget_options['classname'] );
    373373                $this->assertEquals( $control_options['id_base'], $bar_widget->control_options['id_base'] );
    … …  
    380380         */
    381381        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' );
    383383                $widget->_set( 2 );
    384384                $this->assertEquals( $expected, $widget->get_field_name( $value_to_test ) );
    … …  
    431431         */
    432432        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' );
    434434                $widget->_set( 2 );
    435435                $this->assertEquals( $expected, $widget->get_field_id( $value_to_test ) );
    … …  
    504504                global $wp_customize;
    505505
    506                 $widget = new WP_Widget_Mock( 'foo', 'Foo' );
     506                $widget = new WP_Widget( 'foo', 'Foo' );
    507507
    508508                $this->assertEmpty( $wp_customize );
    … …  
    680680
    681681}
    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.