| | 683 | * @ticket 35084 |
| | 684 | */ |
| | 685 | function test_get_post_uri_check_ancestor_post_status() { |
| | 686 | |
| | 687 | $post_statuses = get_post_stati( array(), 'objects' ); |
| | 688 | |
| | 689 | foreach( $post_statuses as $index => $post_status ){ |
| | 690 | $parent_id = self::factory()->post->create( array( 'post_name' => 'parent_' . $index, 'post_status' => $post_status->name ) ); |
| | 691 | $child_id = self::factory()->post->create( array( 'post_name' => 'child_' . $index, 'post_parent' => $parent_id ) ); |
| | 692 | |
| | 693 | // check the parent for good measure |
| | 694 | $this->assertEquals( 'parent_' . $index, get_page_uri( $parent_id ) ); |
| | 695 | |
| | 696 | // if the parent's post status is not an internal post status, it should be in the uri |
| | 697 | if( ! ( $post_status->internal ) ){ |
| | 698 | $this->assertEquals( 'parent_' . $index . '/child_' . $index, get_page_uri( $child_id ) ); |
| | 699 | } |
| | 700 | else{ |
| | 701 | $this->assertEquals( 'child_' . $index, get_page_uri( $child_id ) ); |
| | 702 | } |
| | 703 | } |
| | 704 | } |
| | 705 | |
| | 706 | /** |