Make WordPress Core

Changeset 27803


Ignore:
Timestamp:
03/28/2014 03:01:43 AM (11 years ago)
Author:
nacin
Message:

Add a unit test for shortlinks of a page on front.

see #26871, see [27802].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/link.php

    r27692 r27803  
    9898
    9999    /**
     100     * @ticket 26871
     101     */
     102    function test_wp_get_shortlink_with_home_page() {
     103        $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     104        update_option( 'show_on_front', 'page' );
     105        update_option( 'page_on_front', $post_id );
     106
     107        $this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
     108
     109        global $wp_rewrite;
     110        $wp_rewrite->permalink_structure = '';
     111        $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
     112        $wp_rewrite->flush_rules();
     113
     114        $this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
     115
     116        $wp_rewrite->set_permalink_structure( '' );
     117        $wp_rewrite->flush_rules();
     118    }
     119
     120    /**
    100121     * @ticket 17807
    101122     */
Note: See TracChangeset for help on using the changeset viewer.