WordPress.org

Make WordPress Core

Ticket #13459: 13459-unit-tests-post.php.patch

File 13459-unit-tests-post.php.patch, 1.0 KB (added by moraleida.me, 5 years ago)
  • post.php

     
    492492        }
    493493
    494494        /**
     495         * @ticket 13459
     496         */
     497        function test_wp_unique_post_slug_across_post_types_if_permalink_is_only_postname() {
     498
     499                // change permalink structure to /%postname%/
     500                global $wp_rewrite;
     501                $wp_rewrite->set_permalink_structure('/%postname%/');
     502                $wp_rewrite->flush_rules();
     503
     504                // create post and page with the exact same title
     505                $page = $this->factory->post->create_and_get( array( 'post_title' => 'identical-title', 'post_type' => 'page' ) );
     506                $post = $this->factory->post->create_and_get( array( 'post_title' => 'identical-title', 'post_type' => 'post' ) );
     507
     508                // expect them to have different slugs, avoiding URL conflict
     509                $this->assertNotEquals( $post->post_name, $page->post_name );
     510
     511                // clean up
     512                $wp_rewrite->set_permalink_structure('');
     513
     514        }
     515
     516        /**
    495517         * @ticket 15665
    496518         */
    497519        function test_get_page_by_path_priority() {