WordPress.org

Make WordPress Core

Changeset 1021 in tests


Ignore:
Timestamp:
09/14/2012 05:17:32 PM (6 years ago)
Author:
nacin
Message:

Tests for #WP15665 - "Page name won't work if the parent page has an attachment with the same name"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/post.php

    r912 r1021  
    468468        }
    469469    }
     470
     471    /**
     472     * @ticket 15665
     473     */
     474    function test_get_page_by_path_priority() {
     475        $attachment = $this->factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'attachment' ) );
     476        $page       = $this->factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'page' ) );
     477        $other_att  = $this->factory->post->create_and_get( array( 'post_title' => 'some-other-page', 'post_type' => 'attachment' ) );
     478
     479        $this->assertEquals( 'some-page', $attachment->post_name );
     480        $this->assertEquals( 'some-page', $page->post_name );
     481
     482        // get_page_by_path() should return a post of the requested type before returning an attachment.
     483        $this->assertEquals( $page, get_page_by_path( 'some-page' ) );
     484
     485        // Make sure get_page_by_path() will still select an attachment when a post of the requested type doesn't exist.
     486        $this->assertEquals( $other_att, get_page_by_path( 'some-other-page' ) );
     487    }
    470488}
Note: See TracChangeset for help on using the changeset viewer.