Changeset 52010 for trunk/tests/phpunit/tests/widgets.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/widgets.php
r51791 r52010 10 10 public $valid_sidebar; 11 11 12 function clean_up_global_scope() {12 public function clean_up_global_scope() { 13 13 global $wp_widget_factory, $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates; 14 14 … … 22 22 } 23 23 24 function tear_down() {24 public function tear_down() { 25 25 global $wp_customize; 26 26 … … 34 34 * @see unregister_widget() 35 35 */ 36 function test_register_and_unregister_widget_core_widget() {36 public function test_register_and_unregister_widget_core_widget() { 37 37 global $wp_widget_factory; 38 38 … … 53 53 * @ticket 28216 54 54 */ 55 function test_register_and_unregister_widget_instance() {55 public function test_register_and_unregister_widget_instance() { 56 56 global $wp_widget_factory, $wp_registered_widgets; 57 57 … … 130 130 * @group sidebar 131 131 */ 132 function test_register_sidebars_single() {132 public function test_register_sidebars_single() { 133 133 global $wp_registered_sidebars; 134 134 … … 142 142 * @group sidebar 143 143 */ 144 function test_register_sidebars_multiple() {144 public function test_register_sidebars_multiple() { 145 145 global $wp_registered_sidebars; 146 146 … … 164 164 * @group sidebar 165 165 */ 166 function test_register_sidebar_with_no_id() {166 public function test_register_sidebar_with_no_id() { 167 167 global $wp_registered_sidebars; 168 168 … … 181 181 * @group sidebar 182 182 */ 183 function test_unregister_sidebar_registered_with_no_id() {183 public function test_unregister_sidebar_registered_with_no_id() { 184 184 global $wp_registered_sidebars; 185 185 … … 200 200 * @group sidebar 201 201 */ 202 function test_register_sidebar_with_string_id() {202 public function test_register_sidebar_with_string_id() { 203 203 global $wp_registered_sidebars; 204 204 … … 212 212 * @group sidebar 213 213 */ 214 function test_unregister_sidebar_with_string_id() {214 public function test_unregister_sidebar_with_string_id() { 215 215 global $wp_registered_sidebars; 216 216 … … 225 225 * @group sidebar 226 226 */ 227 function test_register_sidebar_with_numeric_id() {227 public function test_register_sidebar_with_numeric_id() { 228 228 global $wp_registered_sidebars; 229 229 … … 237 237 * @group sidebar 238 238 */ 239 function test_unregister_sidebar_with_numeric_id() {239 public function test_unregister_sidebar_with_numeric_id() { 240 240 global $wp_registered_sidebars; 241 241 … … 293 293 * Utility hook callback used to store a sidebar ID mid-function. 294 294 */ 295 function retrieve_sidebar_id( $index, $valid_sidebar ) {295 public function retrieve_sidebar_id( $index, $valid_sidebar ) { 296 296 $this->sidebar_index = $index; 297 297 $this->valid_sidebar = $valid_sidebar; … … 301 301 * @group sidebar 302 302 */ 303 function test_dynamic_sidebar_using_sidebar_registered_with_no_id() {303 public function test_dynamic_sidebar_using_sidebar_registered_with_no_id() { 304 304 $this->setExpectedIncorrectUsage( 'register_sidebar' ); 305 305 … … 320 320 * @group sidebar 321 321 */ 322 function test_dynamic_sidebar_using_invalid_sidebar_id() {322 public function test_dynamic_sidebar_using_invalid_sidebar_id() { 323 323 register_sidebar( array( 'id' => 'wp-unit-text' ) ); 324 324 … … 338 338 * @group sidebar 339 339 */ 340 function test_dynamic_sidebar_numeric_id() {340 public function test_dynamic_sidebar_numeric_id() { 341 341 $sidebar_id = 2; 342 342 register_sidebar( array( 'id' => $sidebar_id ) ); … … 352 352 * @group sidebar 353 353 */ 354 function test_dynamic_sidebar_string_id() {354 public function test_dynamic_sidebar_string_id() { 355 355 $sidebar_id = 'wp-unit-tests'; 356 356 register_sidebar( array( 'id' => $sidebar_id ) ); … … 366 366 * @see WP_Widget_Search::form() 367 367 */ 368 function test_wp_widget_search_form() {368 public function test_wp_widget_search_form() { 369 369 $widget = new WP_Widget_Search( 'foo', 'Foo' ); 370 370 ob_start(); … … 388 388 * @see WP_Widget::form() 389 389 */ 390 function test_wp_widget_form() {390 public function test_wp_widget_form() { 391 391 $widget = new WP_Widget( 'foo', 'Foo' ); 392 392 ob_start(); … … 400 400 * @see WP_Widget::__construct() 401 401 */ 402 function test_wp_widget_constructor() {402 public function test_wp_widget_constructor() { 403 403 $id_base = 'foo'; 404 404 $name = 'Foo'; … … 431 431 * @dataProvider data_wp_widget_classname 432 432 */ 433 function test_wp_widget_classname( $expected, $widget_class ) {433 public function test_wp_widget_classname( $expected, $widget_class ) { 434 434 require_once DIR_TESTDATA . '/widgets/custom-widget-classes.php'; 435 435 … … 453 453 * } 454 454 */ 455 function data_wp_widget_classname() {455 public function data_wp_widget_classname() { 456 456 return array( 457 457 array( … … 474 474 * @dataProvider data_wp_widget_get_field_name 475 475 */ 476 function test_wp_widget_get_field_name( $expected, $value_to_test ) {476 public function test_wp_widget_get_field_name( $expected, $value_to_test ) { 477 477 $widget = new WP_Widget( 'foo', 'Foo' ); 478 478 $widget->_set( 2 ); … … 494 494 * } 495 495 */ 496 function data_wp_widget_get_field_name() {496 public function data_wp_widget_get_field_name() { 497 497 return array( 498 498 array( … … 523 523 * @dataProvider data_wp_widget_get_field_id 524 524 */ 525 function test_wp_widget_get_field_id( $expected, $value_to_test ) {525 public function test_wp_widget_get_field_id( $expected, $value_to_test ) { 526 526 $widget = new WP_Widget( 'foo', 'Foo' ); 527 527 $widget->_set( 2 ); … … 544 544 * } 545 545 */ 546 function data_wp_widget_get_field_id() {546 public function data_wp_widget_get_field_id() { 547 547 return array( 548 548 array( … … 572 572 * @see WP_Widget::_register() 573 573 */ 574 function test_wp_widget__register() {574 public function test_wp_widget__register() { 575 575 global $wp_registered_widgets; 576 576 … … 594 594 * @see WP_Widget::is_preview() 595 595 */ 596 function test_wp_widget_is_preview() {596 public function test_wp_widget_is_preview() { 597 597 global $wp_customize; 598 598 … … 617 617 * @see WP_Widget::get_settings() 618 618 */ 619 function test_wp_widget_get_settings() {619 public function test_wp_widget_get_settings() { 620 620 global $wp_registered_widgets; 621 621 … … 654 654 * @see WP_Widget::save_settings() 655 655 */ 656 function test_wp_widget_save_settings() {656 public function test_wp_widget_save_settings() { 657 657 global $wp_registered_widgets; 658 658 … … 685 685 * @see WP_Widget::save_settings() 686 686 */ 687 function test_wp_widget_save_settings_delete() {687 public function test_wp_widget_save_settings_delete() { 688 688 global $wp_registered_widgets; 689 689 … … 702 702 * @see wp_widget_control() 703 703 */ 704 function test_wp_widget_control() {704 public function test_wp_widget_control() { 705 705 global $wp_registered_widgets; 706 706 … … 780 780 } 781 781 782 function test_the_widget_custom_before_title_arg() {782 public function test_the_widget_custom_before_title_arg() { 783 783 register_widget( 'WP_Widget_Text' ); 784 784 … … 809 809 * @see \the_widget() 810 810 */ 811 function test_the_widget_with_unregistered_widget() {811 public function test_the_widget_with_unregistered_widget() { 812 812 $this->setExpectedIncorrectUsage( 'the_widget' ); 813 813 the_widget( 'Widget_Class' ); … … 835 835 * @param array $sidebars Sidebar slugs. 836 836 */ 837 function register_sidebars( $sidebars ) {837 private function register_sidebars( $sidebars ) { 838 838 foreach ( $sidebars as $sidebar ) { 839 839 register_sidebar( array( 'id' => $sidebar ) ); … … 846 846 * @covers ::retrieve_widgets 847 847 */ 848 function test_retrieve_widgets_with_theme_mod() {848 public function test_retrieve_widgets_with_theme_mod() { 849 849 global $sidebars_widgets, $_wp_sidebars_widgets; 850 850 … … 909 909 * @covers ::retrieve_widgets 910 910 */ 911 function test_retrieve_widgets_with_sidebars_widgets_matching_registered_sidebars() {911 public function test_retrieve_widgets_with_sidebars_widgets_matching_registered_sidebars() { 912 912 global $sidebars_widgets; 913 913 … … 947 947 * @covers ::retrieve_widgets 948 948 */ 949 function test_retrieve_widgets_with_sidebars_widgets_not_matching_registered_sidebars() {949 public function test_retrieve_widgets_with_sidebars_widgets_not_matching_registered_sidebars() { 950 950 global $sidebars_widgets, $_wp_sidebars_widgets; 951 951 … … 1039 1039 * @covers ::retrieve_widgets 1040 1040 */ 1041 function test_retrieve_widgets_for_customizer() {1041 public function test_retrieve_widgets_for_customizer() { 1042 1042 global $sidebars_widgets, $_wp_sidebars_widgets; 1043 1043 … … 1083 1083 } 1084 1084 1085 function test_retrieve_widgets_with_single_widget() {1085 public function test_retrieve_widgets_with_single_widget() { 1086 1086 global $sidebars_widgets; 1087 1087 … … 1110 1110 * @covers ::retrieve_widgets 1111 1111 */ 1112 function test_retrieve_widgets_move_orphaned_widgets_to_inactive() {1112 public function test_retrieve_widgets_move_orphaned_widgets_to_inactive() { 1113 1113 global $sidebars_widgets; 1114 1114
Note: See TracChangeset
for help on using the changeset viewer.