Changeset 46819 for trunk/tests/phpunit/tests/post.php
- Timestamp:
- 12/06/2019 05:25:32 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post.php
r46586 r46819 560 560 } 561 561 562 /**563 * @ticket 15665564 */565 function test_get_page_by_path_priority() {566 global $wpdb;567 568 $attachment = self::factory()->post->create_and_get(569 array(570 'post_title' => 'some-page',571 'post_type' => 'attachment',572 )573 );574 $page = self::factory()->post->create_and_get(575 array(576 'post_title' => 'some-page',577 'post_type' => 'page',578 )579 );580 $other_att = self::factory()->post->create_and_get(581 array(582 'post_title' => 'some-other-page',583 'post_type' => 'attachment',584 )585 );586 587 $wpdb->update( $wpdb->posts, array( 'post_name' => 'some-page' ), array( 'ID' => $page->ID ) );588 clean_post_cache( $page->ID );589 590 $page = get_post( $page->ID );591 592 $this->assertEquals( 'some-page', $attachment->post_name );593 $this->assertEquals( 'some-page', $page->post_name );594 595 // get_page_by_path() should return a post of the requested type before returning an attachment.596 $this->assertEquals( $page, get_page_by_path( 'some-page' ) );597 598 // Make sure get_page_by_path() will still select an attachment when a post of the requested type doesn't exist.599 $this->assertEquals( $other_att, get_page_by_path( 'some-other-page' ) );600 }601 602 562 function test_wp_publish_post() { 603 563 $draft_id = self::factory()->post->create( array( 'post_status' => 'draft' ) );
Note: See TracChangeset
for help on using the changeset viewer.