Changeset 48937 for trunk/tests/phpunit/tests/widgets.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/widgets.php
r48858 r48937 156 156 } 157 157 158 $this->assert Equals( $num, count( $result ) );158 $this->assertSame( $num, count( $result ) ); 159 159 160 160 } … … 289 289 * the 'dynamic_sidebar_before' hook will be false. 290 290 */ 291 $this->assert Same( false,$this->valid_sidebar );291 $this->assertFalse( $this->valid_sidebar ); 292 292 } 293 293 … … 350 350 $retval = $widget->form( array() ); 351 351 $output = ob_get_clean(); 352 $this->assert Equals( 'noform', $retval );352 $this->assertSame( 'noform', $retval ); 353 353 $this->assertContains( 'no-options-widget', $output ); 354 354 } … … 362 362 $foo_widget = new WP_Widget( $id_base, $name ); 363 363 364 $this->assert Equals( $id_base, $foo_widget->id_base );365 $this->assert Equals( $name, $foo_widget->name );366 $this->assert Equals( "widget_{$id_base}", $foo_widget->option_name );364 $this->assertSame( $id_base, $foo_widget->id_base ); 365 $this->assertSame( $name, $foo_widget->name ); 366 $this->assertSame( "widget_{$id_base}", $foo_widget->option_name ); 367 367 $this->assertArrayHasKey( 'classname', $foo_widget->widget_options ); 368 $this->assert Equals( "widget_{$id_base}", $foo_widget->widget_options['classname'] );368 $this->assertSame( "widget_{$id_base}", $foo_widget->widget_options['classname'] ); 369 369 $this->assertArrayHasKey( 'id_base', $foo_widget->control_options ); 370 $this->assert Equals( $id_base, $foo_widget->control_options['id_base'] );370 $this->assertSame( $id_base, $foo_widget->control_options['id_base'] ); 371 371 372 372 $id_base = 'bar'; … … 379 379 ); 380 380 $bar_widget = new WP_Widget( $id_base, $name, $widget_options, $control_options ); 381 $this->assert Equals( $widget_options['classname'], $bar_widget->widget_options['classname'] );382 $this->assert Equals( $control_options['id_base'], $bar_widget->control_options['id_base'] );381 $this->assertSame( $widget_options['classname'], $bar_widget->widget_options['classname'] ); 382 $this->assertSame( $control_options['id_base'], $bar_widget->control_options['id_base'] ); 383 383 } 384 384 … … 390 390 $widget = new WP_Widget( 'foo', 'Foo' ); 391 391 $widget->_set( 2 ); 392 $this->assert Equals( $expected, $widget->get_field_name( $value_to_test ) );392 $this->assertSame( $expected, $widget->get_field_name( $value_to_test ) ); 393 393 } 394 394 … … 440 440 $widget = new WP_Widget( 'foo', 'Foo' ); 441 441 $widget->_set( 2 ); 442 $this->assert Equals( $expected, $widget->get_field_id( $value_to_test ) );442 $this->assertSame( $expected, $widget->get_field_id( $value_to_test ) ); 443 443 } 444 444 … … 536 536 $option_value = get_option( 'widget_search' ); 537 537 $this->assertArrayHasKey( '_multiwidget', $option_value ); 538 $this->assert Equals( 1, $option_value['_multiwidget'] );538 $this->assertSame( 1, $option_value['_multiwidget'] ); 539 539 $this->assertArrayHasKey( 2, $option_value ); 540 540 $instance = $option_value[2]; … … 546 546 delete_option( 'widget_nav_menu' ); 547 547 $never_used = get_option( 'widget_nav_menu', array() ); 548 $this->assert Equals( array(), (array) $never_used );548 $this->assertSame( array(), (array) $never_used ); 549 549 550 550 wp_widgets_init(); … … 556 556 557 557 foreach ( $option_value as $widget_number => $instance ) { 558 $this->assert Equals( $settings[ $widget_number ], $option_value[ $widget_number ] );558 $this->assertSame( $settings[ $widget_number ], $option_value[ $widget_number ] ); 559 559 } 560 560 561 561 // After widgets_init(), get_settings() should create the widget option. 562 562 $never_used = get_option( 'widget_nav_menu' ); 563 $this->assert Equals( 1, $never_used['_multiwidget'] );563 $this->assertSame( 1, $never_used['_multiwidget'] ); 564 564 $this->assertArrayNotHasKey( 0, $never_used ); 565 565 } … … 593 593 $option_value = get_option( $wp_widget_search->option_name ); 594 594 $this->assertArrayHasKey( '_multiwidget', $option_value ); 595 $this->assert Equals( $overridden_title, $option_value[2]['title'] );595 $this->assertSame( $overridden_title, $option_value[2]['title'] ); 596 596 } 597 597 … … 774 774 775 775 $this->assertInternalType( 'array', $result ); 776 $this->assert Equals( $result, $sidebars_widgets );776 $this->assertSame( $result, $sidebars_widgets ); 777 777 778 778 foreach ( $sidebars_widgets as $widgets ) { … … 799 799 800 800 // Sidebar_widgets option was updated. 801 $this->assert Equals( $sidebars_widgets, wp_get_sidebars_widgets() );801 $this->assertSame( $sidebars_widgets, wp_get_sidebars_widgets() ); 802 802 } 803 803 … … 824 824 // $sidebars_widgets matches registered sidebars. 825 825 $this->assertInternalType( 'array', $result ); 826 $this->assert Equals( $result, $sidebars_widgets );826 $this->assertSame( $result, $sidebars_widgets ); 827 827 828 828 foreach ( $sidebars_widgets as $widgets ) { … … 863 863 $_wp_sidebars_widgets = array(); 864 864 $this->assertInternalType( 'array', $result ); 865 $this->assert Equals( $result, $sidebars_widgets );865 $this->assertSame( $result, $sidebars_widgets ); 866 866 867 867 foreach ( $sidebars_widgets as $widgets ) { … … 891 891 892 892 // Sidebar_widgets option was updated. 893 $this->assert Equals( $sidebars_widgets, wp_get_sidebars_widgets() );893 $this->assertSame( $sidebars_widgets, wp_get_sidebars_widgets() ); 894 894 895 895 // Reset. … … 906 906 $_wp_sidebars_widgets = array(); 907 907 $this->assertInternalType( 'array', $result ); 908 $this->assert Equals( $result, $sidebars_widgets );908 $this->assertSame( $result, $sidebars_widgets ); 909 909 910 910 foreach ( $sidebars_widgets as $widgets ) { … … 931 931 932 932 // Sidebar_widgets option was updated. 933 $this->assert Equals( $sidebars_widgets, wp_get_sidebars_widgets() );933 $this->assertSame( $sidebars_widgets, wp_get_sidebars_widgets() ); 934 934 } 935 935 … … 958 958 $_wp_sidebars_widgets = array(); 959 959 $this->assertInternalType( 'array', $result ); 960 $this->assert Equals( $result, $sidebars_widgets );960 $this->assertSame( $result, $sidebars_widgets ); 961 961 962 962 foreach ( $sidebars_widgets as $widgets ) { … … 1038 1038 1039 1039 // Sidebar_widgets option was updated. 1040 $this->assert Equals( $sidebars_widgets, wp_get_sidebars_widgets() );1040 $this->assertSame( $sidebars_widgets, wp_get_sidebars_widgets() ); 1041 1041 } 1042 1042 … … 1063 1063 $this->assertEmpty( $filtered_widgets['fantasy'] ); 1064 1064 $this->assertArrayHasKey( 'array_version', $filtered_widgets ); 1065 $this->assert Equals( 3, $filtered_widgets['array_version'] );1065 $this->assertSame( 3, $filtered_widgets['array_version'] ); 1066 1066 $this->assertInternalType( 'integer', $filtered_widgets['array_version'] ); 1067 1067 }
Note: See TracChangeset
for help on using the changeset viewer.