Ticket #26284: 26284.2.diff
File 26284.2.diff, 1.4 KB (added by , 9 years ago) |
---|
-
src/wp-includes/post.php
4428 4428 * Sub pages will be in the "directory" under the parent page post name. 4429 4429 * 4430 4430 * @since 1.5.0 4431 * @since 4.6.0 The $page parameter is optional. 4431 4432 * 4432 * @param WP_Post|object|int $page Page object or page ID.4433 * @param WP_Post|object|int $page Optional. Page ID or WP_Post object. Default is global $post. 4433 4434 * @return string|false Page URI, false on error. 4434 4435 */ 4435 function get_page_uri( $page ) {4436 function get_page_uri( $page = 0 ) { 4436 4437 if ( ! $page instanceof WP_Post ) { 4437 4438 $page = get_post( $page ); 4438 4439 } -
tests/phpunit/tests/post/getPageUri.php
1 <?php 2 3 /** 4 * @group post 5 */ 6 class Tests_Post_getPageUri extends WP_UnitTestCase { 7 8 function test_get_page_uri_without_argument() { 9 $post_id = self::factory()->post->create(array( 10 'post_title' => 'Blood Orange announces summer tour dates', 11 'post_name' => 'blood-orange-announces-summer-tour-dates', 12 )); 13 $post = get_post( $post_id ); 14 $this->go_to( get_permalink( $post_id ) ); 15 $this->assertEquals( 'blood-orange-announces-summer-tour-dates', get_page_uri() ); 16 } 17 }