Skip to content

Commit bc8f8c5

Browse files
committed
Returning back the insert part of a merged test
1 parent 5d912fe commit bc8f8c5

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

tests/phpunit/tests/post/wpInsertPost.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,6 @@ public function test_wp_insert_post_should_invalidate_post_cache_before_generati
529529

530530
/**
531531
* @ticket 55877
532-
* @covers ::wp_insert_post
533532
*/
534533
public function test_wp_insert_post_should_not_trigger_warning_for_pending_posts_with_unknown_cpt() {
535534
$post_id = wp_insert_post(
@@ -634,6 +633,20 @@ public function test_get_post_ancestors_within_loop() {
634633
$this->assertSame( array( $parent_id ), get_post_ancestors( 0 ) );
635634
}
636635

636+
/**
637+
* @ticket 23474
638+
*/
639+
public function test_insert_invalid_post_id() {
640+
$post_id = self::factory()->post->create();
641+
$post = get_post( $post_id, ARRAY_A );
642+
643+
$post['ID'] = 123456789;
644+
645+
$this->assertSame( 0, wp_insert_post( $post ) );
646+
647+
$this->assertInstanceOf( 'WP_Error', wp_insert_post( $post, true ) );
648+
}
649+
637650
/**
638651
* @ticket 19373
639652
*/

tests/phpunit/tests/post/wpUpdatePost.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,8 @@ public function test_update_invalid_post_id() {
109109

110110
$post['ID'] = 123456789;
111111

112-
$this->assertSame( 0, wp_insert_post( $post ) );
113112
$this->assertSame( 0, wp_update_post( $post ) );
114113

115-
$this->assertInstanceOf( 'WP_Error', wp_insert_post( $post, true ) );
116114
$this->assertInstanceOf( 'WP_Error', wp_update_post( $post, true ) );
117115
}
118116

@@ -194,11 +192,11 @@ public function test_wp_update_post_with_content_filtering() {
194192
*
195193
* @ticket 62468
196194
*
197-
* @dataProvider data_post_status_transitions
195+
* @dataProvider data_update_post_preserves_date_for_future_posts
198196
*
199197
* @param string $initial_status Initial post status.
200198
*/
201-
public function test_update_post_preserves_date( $initial_status ) {
199+
public function test_update_post_preserves_date_for_future_posts( $initial_status ) {
202200

203201
$post_id = self::factory()->post->create(
204202
array(
@@ -220,11 +218,11 @@ public function test_update_post_preserves_date( $initial_status ) {
220218
}
221219

222220
/**
223-
* Data provider for test_update_post_preserves_date
221+
* Data provider for test_update_post_preserves_date_for_future_posts
224222
*
225223
* @return array[] Test parameters
226224
*/
227-
public function data_post_status_transitions() {
225+
public function data_update_post_preserves_date_for_future_posts() {
228226
return array(
229227
'pending to future' => array(
230228
'initial_status' => 'pending',

0 commit comments

Comments
 (0)