| 183 | |
| 184 | /** |
| 185 | * @ticket 35324 |
| 186 | */ |
| 187 | function test_wp_setup_nav_menu_item_for_post_type_archive() { |
| 188 | |
| 189 | $post_type_slug = rand_str( 12 ); |
| 190 | $post_type_description = rand_str(); |
| 191 | register_post_type( $post_type_slug ,array( |
| 192 | 'public' => true, |
| 193 | 'has_archive' => true, |
| 194 | 'description' => $post_type_description, |
| 195 | 'label' => $post_type_slug |
| 196 | )); |
| 197 | |
| 198 | $post_type_archive_item_id = wp_update_nav_menu_item( $this->menu_id, 0, array( |
| 199 | 'menu-item-type' => 'post_type_archive', |
| 200 | 'menu-item-object' => $post_type_slug, |
| 201 | 'menu-item-status' => 'publish' |
| 202 | ) ); |
| 203 | $post_type_archive_item = wp_setup_nav_menu_item( get_post( $post_type_archive_item_id ) ); |
| 204 | |
| 205 | $this->assertEquals( $post_type_slug , $post_type_archive_item->title ); |
| 206 | $this->assertEquals( $post_type_description , $post_type_archive_item->description ); //fail!!! |
| 207 | |
| 208 | $custom_description = rand_str(); |
| 209 | wp_update_nav_menu_item( $this->menu_id, $post_type_archive_item_id, array( |
| 210 | 'menu-item-title' => 'WordPress', |
| 211 | 'menu-item-description' => $custom_description |
| 212 | ) ); |
| 213 | $post_type_archive_item = wp_setup_nav_menu_item( get_post( $post_type_archive_item_id ) ); |
| 214 | $this->assertEquals( 'WordPress', $post_type_archive_item->title ); |
| 215 | $this->assertEquals( $custom_description, $post_type_archive_item->description ); |
| 216 | } |