WordPress.org

Make WordPress Core

Ticket #26284: 26284.diff

File 26284.diff, 1.5 KB (added by ericlewis, 5 years ago)
  • src/wp-includes/post.php

     
    44284428 * Sub pages will be in the "directory" under the parent page post name.
    44294429 *
    44304430 * @since 1.5.0
     4431 * @since 4.6.0 The $page parameter is optional.
    44314432 *
    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.
    44334434 * @return string|false Page URI, false on error.
    44344435 */
    4435 function get_page_uri( $page ) {
     4436function get_page_uri( $page = 0 ) {
    44364437        if ( ! $page instanceof WP_Post ) {
    44374438                $page = get_post( $page );
    44384439        }
  • tests/phpunit/tests/post/getPageUri.php

     
     1<?php
     2
     3/**
     4 * @group post
     5 */
     6
     7class Tests_Post_getPageUri extends WP_UnitTestCase {
     8
     9        /**
     10         * @group f
     11         */
     12        function test_get_page_uri_without_argument() {
     13                $post_id = self::factory()->post->create(array(
     14      'post_title' => 'Blood Orange announces summer tour dates',
     15      'post_name' => 'blood-orange-announces-summer-tour-dates',
     16    ));
     17    $post = get_post( $post_id );
     18                $this->go_to( get_permalink( $post_id ) );
     19    $this->assertEquals( 'blood-orange-announces-summer-tour-dates', get_page_uri() );
     20        }
     21}