From 5e2861c92d99db320cae1360453829917880a21b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 27 Jul 2022 16:07:20 +0000 Subject: [PATCH] Tests: Don't unnecessarily randomize the post type in some `wp_insert_post()` tests. Follow-up to [33041], [52389], [53785], [53787]. See #55652. git-svn-id: https://develop.svn.wordpress.org/trunk@53788 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/post/wpInsertPost.php | 31 ++++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/tests/phpunit/tests/post/wpInsertPost.php b/tests/phpunit/tests/post/wpInsertPost.php index 49631d78e4..1b54a66f8e 100644 --- a/tests/phpunit/tests/post/wpInsertPost.php +++ b/tests/phpunit/tests/post/wpInsertPost.php @@ -688,8 +688,6 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase { $post_id = self::factory()->post->create( array( 'post_status' => 'publish', - 'post_content' => 'content', - 'post_title' => 'title', ) ); $post = get_post( $post_id ); @@ -705,8 +703,6 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase { $post_id = self::factory()->post->create( array( 'post_status' => 'publish', - 'post_content' => 'content', - 'post_title' => 'title', 'post_type' => 'page', ) ); @@ -720,20 +716,22 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase { * @ticket 31168 */ public function test_wp_insert_post_cpt_default_comment_ping_status_open() { - $post_type = rand_str( 20 ); - register_post_type( $post_type, array( 'supports' => array( 'comments', 'trackbacks' ) ) ); + register_post_type( + 'cpt', + array( + 'supports' => array( 'comments', 'trackbacks' ), + ) + ); $post_id = self::factory()->post->create( array( - 'post_status' => 'publish', - 'post_content' => rand_str(), - 'post_title' => rand_str(), - 'post_type' => $post_type, + 'post_status' => 'publish', + 'post_type' => 'cpt', ) ); $post = get_post( $post_id ); - _unregister_post_type( $post_type ); + _unregister_post_type( 'cpt' ); $this->assertSame( 'open', $post->comment_status ); $this->assertSame( 'open', $post->ping_status ); @@ -743,20 +741,17 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase { * @ticket 31168 */ public function test_wp_insert_post_cpt_default_comment_ping_status_closed() { - $post_type = rand_str( 20 ); - register_post_type( $post_type ); + register_post_type( 'cpt' ); $post_id = self::factory()->post->create( array( - 'post_status' => 'publish', - 'post_content' => rand_str(), - 'post_title' => rand_str(), - 'post_type' => $post_type, + 'post_status' => 'publish', + 'post_type' => 'cpt', ) ); $post = get_post( $post_id ); - _unregister_post_type( $post_type ); + _unregister_post_type( 'cpt' ); $this->assertSame( 'closed', $post->comment_status ); $this->assertSame( 'closed', $post->ping_status );