| | 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 | /** |