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
This commit is contained in:
Sergey Biryukov
2022-07-27 16:07:20 +00:00
parent c52486b995
commit 5e2861c92d

View File

@@ -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 );