Make WordPress Core

Changeset 55979


Ignore:
Timestamp:
06/22/2023 05:53:05 AM (8 months ago)
Author:
SergeyBiryukov
Message:

Tests: Update the test for pre_wp_setup_nav_menu_item filter.

This ensures that not only is the filter applied in wp_setup_nav_menu_item(), but also the actual output is tested.

Follow-up to [55867], [55868].

Props azaozz, ugyensupport.
Fixes #56577.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/nav-menu.php

    r55868 r55979  
    609609        );
    610610
    611         $filter = new MockAction();
    612         add_filter( 'pre_wp_setup_nav_menu_item', array( &$filter, 'filter' ) );
    613 
    614         wp_setup_nav_menu_item( get_post( $menu_item_id ) );
    615 
    616         $this->assertSame( 1, $filter->get_call_count() );
     611        add_filter( 'pre_wp_setup_nav_menu_item', '__return_empty_string' );
     612
     613        $custom_item = wp_setup_nav_menu_item( get_post( $menu_item_id ) );
     614
     615        $this->assertSame( '', $custom_item );
    617616    }
    618617
Note: See TracChangeset for help on using the changeset viewer.