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

see #26871, see [27802].


git-svn-id: https://develop.svn.wordpress.org/trunk@27803 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2014-03-28 03:01:43 +00:00
parent 09d8fe1b09
commit 7a3c12d985
1 changed files with 21 additions and 0 deletions

View File

@ -96,6 +96,27 @@ class Tests_Link extends WP_UnitTestCase {
$wp_rewrite->flush_rules();
}
/**
* @ticket 26871
*/
function test_wp_get_shortlink_with_home_page() {
$post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $post_id );
$this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
global $wp_rewrite;
$wp_rewrite->permalink_structure = '';
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
$wp_rewrite->flush_rules();
$this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
$wp_rewrite->set_permalink_structure( '' );
$wp_rewrite->flush_rules();
}
/**
* @ticket 17807
*/