Changeset 52173
- Timestamp:
- 11/16/2021 01:41:23 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-widget.php
r51070 r52173 366 366 $instances = $this->get_settings(); 367 367 368 if ( array_key_exists( $this->number, $instances) ) {368 if ( isset( $instances[ $this->number ] ) ) { 369 369 $instance = $instances[ $this->number ]; 370 370 -
trunk/tests/phpunit/tests/widgets.php
r52010 r52173 590 590 591 591 // @todo Test WP_Widget::display_callback(). 592 593 /** 594 * @ticket 52728 595 */ 596 function test_widget_display_callback_handles_arrayobject() { 597 $widget = new WP_Widget_Text(); 598 599 register_widget( $widget ); 600 601 add_filter( 602 "pre_option_{$widget->option_name}", 603 static function() { 604 return new ArrayObject( 605 array( 606 2 => array( 'title' => 'Test Title' ), 607 '_multiwidget' => 1, 608 '__i__' => true, 609 ) 610 ); 611 } 612 ); 613 614 // Effectively ignore the output until retrieving it later via `getActualOutput()`. 615 $this->expectOutputRegex( '`.`' ); 616 617 $widget->display_callback( 618 array( 619 'before_widget' => '<section>', 620 'after_widget' => "</section>\n", 621 'before_title' => '<h2>', 622 'after_title' => "</h2>\n", 623 ), 624 2 625 ); 626 627 $actual = $this->getActualOutput(); 628 629 unregister_widget( $widget ); 630 631 $this->assertStringContainsString( 'Test Title', $actual ); 632 } 592 633 593 634 /**
Note: See TracChangeset
for help on using the changeset viewer.