WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #35324, comment 4


Ignore:
Timestamp:
02/12/2016 02:37:06 PM (6 years ago)
Author:
Toro_Unit
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35324, comment 4

    initial v1  
    1 to the description, post type description should be input by default.
     1To the description, post type description should be input by default.
    22
    3 Add new patch and Test.
     3{{{#!php
     4<?php
     5
     6class SampleTest extends WP_UnitTestCase {
     7        /**
     8         * @var int
     9         */
     10        public $menu_id;
     11
     12        function setUp() {
     13                parent::setUp();
     14
     15                $this->menu_id = wp_create_nav_menu( rand_str() );
     16        }
     17
     18        function test_wp_setup_nav_menu_item_for_post_type_archive() {
     19
     20                $post_type_slug = rand_str( 12 );
     21                $post_type_description = rand_str();
     22                register_post_type( $post_type_slug ,array(
     23                        'public' => true,
     24                        'has_archive' => true,
     25                        'description' => $post_type_description,
     26                        'label' => $post_type_slug
     27                ));
     28
     29                $post_type_archive_item_id = wp_update_nav_menu_item( $this->menu_id, 0, array(
     30                        'menu-item-type' => 'post_type_archive',
     31                        'menu-item-object' => $post_type_slug,
     32                        'menu-item-status' => 'publish'
     33                ) );
     34                $post_type_archive_item = wp_setup_nav_menu_item( get_post( $post_type_archive_item_id ) );
     35
     36                $this->assertEquals( $post_type_slug , $post_type_archive_item->title );
     37                $this->assertEquals( $post_type_description , $post_type_archive_item->description ); //fail!!!
     38               
     39        }
     40}
     41}}}
     42
     43
     44Add new patch and Detailed test.