- Timestamp:
- 12/02/2016 12:25:47 AM (8 years ago)
- Location:
- branches/4.7
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7
-
branches/4.7/tests/phpunit/tests/post/wpUniquePostSlug.php
r38938 r39412 348 348 $this->assertSame( 'embed-2', $found ); 349 349 } 350 351 /** 352 * @ticket 38928 353 */ 354 public function test_non_unique_slugs_for_existing_auto_draft_posts() { 355 $auto_draft_post_id = self::factory()->post->create( array( 356 'post_type' => 'post', 357 'post_name' => 'existing-post', 358 'post_status' => 'auto-draft', 359 ) ); 360 $auto_draft_page_id = self::factory()->post->create( array( 361 'post_type' => 'page', 362 'post_name' => 'existing-page', 363 'post_status' => 'auto-draft', 364 ) ); 365 $auto_draft_attachment_id = self::factory()->attachment->create_object( 'image.jpg', $auto_draft_page_id, array( 366 'post_mime_type' => 'image/jpeg', 367 'post_type' => 'attachment', 368 'post_name' => 'existing-attachment', 369 'post_status' => 'auto-draft', 370 ) ); 371 372 $post_id = self::factory()->post->create( array( 'post_type' => 'post' ) ); 373 $page_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 374 $attachment_id = self::factory()->attachment->create_object( 'image2.jpg', $page_id, array( 375 'post_mime_type' => 'image/jpeg', 376 'post_type' => 'attachment', 377 'post_name' => 'existing-image', 378 ) ); 379 380 $this->assertEquals( 'existing-post', wp_unique_post_slug( 'existing-post', $post_id, 'publish', get_post_type( $post_id ), 0 ) ); 381 wp_publish_post( $auto_draft_post_id ); 382 $this->assertEquals( 'existing-post-2', wp_unique_post_slug( 'existing-post', $post_id, 'publish', get_post_type( $post_id ), 0 ) ); 383 384 $this->assertEquals( 'existing-page', wp_unique_post_slug( 'existing-page', $page_id, 'publish', get_post_type( $page_id ), 0 ) ); 385 wp_publish_post( $auto_draft_page_id ); 386 $this->assertEquals( 'existing-page-2', wp_unique_post_slug( 'existing-page', $page_id, 'publish', get_post_type( $page_id ), 0 ) ); 387 388 $this->assertEquals( 'existing-attachment', wp_unique_post_slug( 'existing-attachment', $attachment_id, 'publish', get_post_type( $attachment_id ), 0 ) ); 389 wp_publish_post( $auto_draft_attachment_id ); 390 $this->assertEquals( 'existing-attachment-2', wp_unique_post_slug( 'existing-attachment', $attachment_id, 'publish', get_post_type( $attachment_id ), 0 ) ); 391 } 350 392 }
Note: See TracChangeset
for help on using the changeset viewer.