Changeset 52010 for trunk/tests/phpunit/tests/post/nav-menu.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/nav-menu.php
r51568 r52010 10 10 public $menu_id; 11 11 12 function set_up() {12 public function set_up() { 13 13 parent::set_up(); 14 14 … … 44 44 } 45 45 46 function test_wp_get_associated_nav_menu_items() {46 public function test_wp_get_associated_nav_menu_items() { 47 47 $tag_id = self::factory()->tag->create(); 48 48 $cat_id = self::factory()->category->create(); … … 141 141 * @ticket 27113 142 142 */ 143 function test_orphan_nav_menu_item() {143 public function test_orphan_nav_menu_item() { 144 144 145 145 // Create an orphan nav menu item. … … 206 206 * @ticket 13910 207 207 */ 208 function test_wp_get_nav_menu_name() {208 public function test_wp_get_nav_menu_name() { 209 209 // Register a nav menu location. 210 210 register_nav_menu( 'primary', 'Primary Navigation' ); … … 225 225 * @ticket 29460 226 226 */ 227 function test_orderby_name_by_default() {227 public function test_orderby_name_by_default() { 228 228 // We are going to create a random number of menus (min 2, max 10). 229 229 $menus_no = rand( 2, 10 ); … … 254 254 * @ticket 35324 255 255 */ 256 function test_wp_setup_nav_menu_item_for_post_type_archive() {256 public function test_wp_setup_nav_menu_item_for_post_type_archive() { 257 257 258 258 $post_type_slug = rand_str( 12 ); … … 287 287 * @ticket 35324 288 288 */ 289 function test_wp_setup_nav_menu_item_for_post_type_archive_no_description() {289 public function test_wp_setup_nav_menu_item_for_post_type_archive_no_description() { 290 290 291 291 $post_type_slug = rand_str( 12 ); … … 318 318 * @ticket 35324 319 319 */ 320 function test_wp_setup_nav_menu_item_for_post_type_archive_custom_description() {320 public function test_wp_setup_nav_menu_item_for_post_type_archive_custom_description() { 321 321 322 322 $post_type_slug = rand_str( 12 ); … … 353 353 * @ticket 35324 354 354 */ 355 function test_wp_setup_nav_menu_item_for_unknown_post_type_archive_no_description() {355 public function test_wp_setup_nav_menu_item_for_unknown_post_type_archive_no_description() { 356 356 357 357 $post_type_slug = rand_str( 12 ); … … 374 374 * @ticket 19038 375 375 */ 376 function test_wp_setup_nav_menu_item_for_trashed_post() {376 public function test_wp_setup_nav_menu_item_for_trashed_post() { 377 377 $post_id = self::factory()->post->create( 378 378 array( … … 400 400 * @ticket 35206 401 401 */ 402 function test_wp_nav_menu_whitespace_options() {402 public function test_wp_nav_menu_whitespace_options() { 403 403 $post_id1 = self::factory()->post->create(); 404 404 $post_id2 = self::factory()->post->create(); … … 487 487 * @ticket 24587 488 488 */ 489 function test_wp_nav_menu_filters_are_passed_args_object() {489 public function test_wp_nav_menu_filters_are_passed_args_object() { 490 490 $tag_id = self::factory()->tag->create(); 491 491 … … 506 506 */ 507 507 // In function. 508 add_filter( 'pre_wp_nav_menu', array( $this, ' _confirm_second_param_args_object' ), 10, 2 );509 add_filter( 'wp_nav_menu_objects', array( $this, ' _confirm_second_param_args_object' ), 10, 2 );510 add_filter( 'wp_nav_menu_items', array( $this, ' _confirm_second_param_args_object' ), 10, 2 );508 add_filter( 'pre_wp_nav_menu', array( $this, 'confirm_second_param_args_object' ), 10, 2 ); 509 add_filter( 'wp_nav_menu_objects', array( $this, 'confirm_second_param_args_object' ), 10, 2 ); 510 add_filter( 'wp_nav_menu_items', array( $this, 'confirm_second_param_args_object' ), 10, 2 ); 511 511 512 512 // In walker. 513 add_filter( 'nav_menu_item_args', array( $this, ' _confirm_nav_menu_item_args_object' ) );514 515 add_filter( 'nav_menu_css_class', array( $this, ' _confirm_third_param_args_object' ), 10, 3 );516 add_filter( 'nav_menu_item_id', array( $this, ' _confirm_third_param_args_object' ), 10, 3 );517 add_filter( 'nav_menu_link_attributes', array( $this, ' _confirm_third_param_args_object' ), 10, 3 );518 add_filter( 'nav_menu_item_title', array( $this, ' _confirm_third_param_args_object' ), 10, 3 );519 520 add_filter( 'walker_nav_menu_start_el', array( $this, ' _confirm_forth_param_args_object' ), 10, 4 );513 add_filter( 'nav_menu_item_args', array( $this, 'confirm_nav_menu_item_args_object' ) ); 514 515 add_filter( 'nav_menu_css_class', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); 516 add_filter( 'nav_menu_item_id', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); 517 add_filter( 'nav_menu_link_attributes', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); 518 add_filter( 'nav_menu_item_title', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); 519 520 add_filter( 'walker_nav_menu_start_el', array( $this, 'confirm_forth_param_args_object' ), 10, 4 ); 521 521 522 522 wp_nav_menu( … … 532 532 */ 533 533 // In function. 534 remove_filter( 'pre_wp_nav_menu', array( $this, ' _confirm_second_param_args_object' ), 10, 2 );535 remove_filter( 'wp_nav_menu_objects', array( $this, ' _confirm_second_param_args_object' ), 10, 2 );536 remove_filter( 'wp_nav_menu_items', array( $this, ' _confirm_second_param_args_object' ), 10, 2 );534 remove_filter( 'pre_wp_nav_menu', array( $this, 'confirm_second_param_args_object' ), 10, 2 ); 535 remove_filter( 'wp_nav_menu_objects', array( $this, 'confirm_second_param_args_object' ), 10, 2 ); 536 remove_filter( 'wp_nav_menu_items', array( $this, 'confirm_second_param_args_object' ), 10, 2 ); 537 537 538 538 // In walker. 539 remove_filter( 'nav_menu_item_args', array( $this, ' _confirm_nav_menu_item_args_object' ) );540 541 remove_filter( 'nav_menu_css_class', array( $this, ' _confirm_third_param_args_object' ), 10, 3 );542 remove_filter( 'nav_menu_item_id', array( $this, ' _confirm_third_param_args_object' ), 10, 3 );543 remove_filter( 'nav_menu_link_attributes', array( $this, ' _confirm_third_param_args_object' ), 10, 3 );544 remove_filter( 'nav_menu_item_title', array( $this, ' _confirm_third_param_args_object' ), 10, 3 );545 546 remove_filter( 'walker_nav_menu_start_el', array( $this, ' _confirm_forth_param_args_object' ), 10, 4 );539 remove_filter( 'nav_menu_item_args', array( $this, 'confirm_nav_menu_item_args_object' ) ); 540 541 remove_filter( 'nav_menu_css_class', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); 542 remove_filter( 'nav_menu_item_id', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); 543 remove_filter( 'nav_menu_link_attributes', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); 544 remove_filter( 'nav_menu_item_title', array( $this, 'confirm_third_param_args_object' ), 10, 3 ); 545 546 remove_filter( 'walker_nav_menu_start_el', array( $this, 'confirm_forth_param_args_object' ), 10, 4 ); 547 547 548 548 } … … 551 551 * Run tests required to confrim Walker_Nav_Menu receives an $args object. 552 552 */ 553 function _confirm_nav_menu_item_args_object( $args ) {553 public function confirm_nav_menu_item_args_object( $args ) { 554 554 $this->assertIsObject( $args ); 555 555 return $args; 556 556 } 557 557 558 function _confirm_second_param_args_object( $ignored_1, $args ) {558 public function confirm_second_param_args_object( $ignored_1, $args ) { 559 559 $this->assertIsObject( $args ); 560 560 return $ignored_1; 561 561 } 562 562 563 function _confirm_third_param_args_object( $ignored_1, $ignored_2, $args ) {563 public function confirm_third_param_args_object( $ignored_1, $ignored_2, $args ) { 564 564 $this->assertIsObject( $args ); 565 565 return $ignored_1; 566 566 } 567 567 568 function _confirm_forth_param_args_object( $ignored_1, $ignored_2, $ignored_3, $args ) {568 public function confirm_forth_param_args_object( $ignored_1, $ignored_2, $ignored_3, $args ) { 569 569 $this->assertIsObject( $args ); 570 570 return $ignored_1; … … 575 575 * @ticket 35272 576 576 */ 577 function test_no_front_page_class_applied() {577 public function test_no_front_page_class_applied() { 578 578 $page_id = self::factory()->post->create( 579 579 array( … … 606 606 * @ticket 35272 607 607 */ 608 function test_class_applied_to_front_page_item() {608 public function test_class_applied_to_front_page_item() { 609 609 $page_id = self::factory()->post->create( 610 610 array( … … 639 639 * @ticket 35272 640 640 */ 641 function test_class_not_applied_to_taxonomies_with_same_id_as_front_page_item() {641 public function test_class_not_applied_to_taxonomies_with_same_id_as_front_page_item() { 642 642 global $wpdb; 643 643 … … 682 682 * @covers ::_wp_delete_customize_changeset_dependent_auto_drafts 683 683 */ 684 function test_wp_delete_customize_changeset_dependent_auto_drafts() {684 public function test_wp_delete_customize_changeset_dependent_auto_drafts() { 685 685 $auto_draft_post_id = $this->factory()->post->create( 686 686 array( … … 736 736 * @ticket 39800 737 737 */ 738 function test_parent_ancestor_for_post_archive() {738 public function test_parent_ancestor_for_post_archive() { 739 739 740 740 register_post_type( … … 822 822 * Provides IRI matching data for _wp_menu_item_classes_by_context() test. 823 823 */ 824 function get_iri_current_menu_items() {824 public function get_iri_current_menu_items() { 825 825 return array( 826 826 array( site_url( '/%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82/' ) ), … … 837 837 * @dataProvider get_iri_current_menu_items 838 838 */ 839 function test_iri_current_menu_item( $custom_link, $current = true ) {839 public function test_iri_current_menu_item( $custom_link, $current = true ) { 840 840 wp_update_nav_menu_item( 841 841 $this->menu_id, … … 866 866 * @group privacy 867 867 */ 868 function test_no_privacy_policy_class_applied() {868 public function test_no_privacy_policy_class_applied() { 869 869 $page_id = self::factory()->post->create( 870 870 array( … … 897 897 * @group privacy 898 898 */ 899 function test_class_applied_to_privacy_policy_page_item() {899 public function test_class_applied_to_privacy_policy_page_item() { 900 900 $page_id = self::factory()->post->create( 901 901 array( … … 931 931 * @dataProvider data_trim_url_for_custom_item 932 932 */ 933 function test_trim_url_for_custom_item( $custom_url, $correct_url ) {933 public function test_trim_url_for_custom_item( $custom_url, $correct_url ) { 934 934 $custom_item_id = wp_update_nav_menu_item( 935 935 $this->menu_id, … … 950 950 * Provides data for test_trim_url_for_custom_item(). 951 951 */ 952 function data_trim_url_for_custom_item() {952 public function data_trim_url_for_custom_item() { 953 953 return array( 954 954 array( 'https://wordpress.org ', 'https://wordpress.org' ), … … 965 965 * @ticket 48011 966 966 */ 967 function test_wp_update_nav_menu_item_with_special_characters_in_category_name() {967 public function test_wp_update_nav_menu_item_with_special_characters_in_category_name() { 968 968 $category_name = 'Test Cat - \"Pre-Slashed\" Cat Name & >'; 969 969 … … 1002 1002 * @ticket 52189 1003 1003 */ 1004 function test_wp_update_nav_menu_item_with_post_date() {1004 public function test_wp_update_nav_menu_item_with_post_date() { 1005 1005 $post_date = '2020-12-28 11:26:35'; 1006 1006 $post_date_gmt = '2020-12-29 10:11:45';
Note: See TracChangeset
for help on using the changeset viewer.