Make WordPress Core


Ignore:
Timestamp:
03/08/2016 06:24:50 PM (9 years ago)
Author:
DrewAPicture
Message:

Menus: Avoid a notice when outputting a description for an existing archive menu item for a post type that doesn't.

Props bradyvercher.
See [36859]. Fixes #35324.

File:
1 edited

Legend:

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

    r36859 r36888  
    259259        $this->assertEquals( $menu_item_description , $post_type_archive_item->description );
    260260    }
     261
     262    /**
     263     * @ticket 35324
     264     */
     265    function test_wp_setup_nav_menu_item_for_unknown_post_type_archive_no_description() {
     266
     267        $post_type_slug = rand_str( 12 );
     268
     269        $post_type_archive_item_id = wp_update_nav_menu_item( $this->menu_id, 0, array(
     270            'menu-item-type'   => 'post_type_archive',
     271            'menu-item-object' => $post_type_slug,
     272            'menu-item-status' => 'publish'
     273        ) );
     274        $post_type_archive_item = wp_setup_nav_menu_item( get_post( $post_type_archive_item_id ) );
     275
     276        $this->assertEmpty( $post_type_archive_item->description );
     277    }
    261278}
Note: See TracChangeset for help on using the changeset viewer.