Make WordPress Core


Ignore:
Timestamp:
01/10/2016 06:27:06 PM (9 years ago)
Author:
swissspidy
Message:

Permalinks: Ensure the page hierarchy is correct for sample permalinks.

Fixes #35368.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesPost.php

    r36113 r36253  
    455455    }
    456456
     457    /**
     458     * @ticket 35368
     459     */
     460    public function test_get_sample_permalink_should_respect_hierarchy_of_draft_pages() {
     461        $this->set_permalink_structure( '/%postname%/' );
     462
     463        $parent = self::factory()->post->create( array(
     464            'post_type'  => 'page',
     465            'post_title' => 'Parent Page',
     466        ) );
     467
     468        $child = self::factory()->post->create( array(
     469            'post_type'   => 'page',
     470            'post_title'  => 'Child Page',
     471            'post_parent' => $parent,
     472            'post_status' => 'draft',
     473        ) );
     474
     475        $actual = get_sample_permalink( $child );
     476        $this->assertSame( home_url() . '/parent-page/%pagename%/', $actual[0] );
     477        $this->assertSame( 'child-page', $actual[1] );
     478    }
     479
    457480    public function test_post_exists_should_match_title() {
    458481        $p = self::factory()->post->create( array(
Note: See TracChangeset for help on using the changeset viewer.