diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php index c1657ca271..dcd950e286 100644 --- a/tests/phpunit/tests/post.php +++ b/tests/phpunit/tests/post.php @@ -594,6 +594,22 @@ class Tests_Post extends WP_UnitTestCase { $this->assertEquals( $future_date, $post->post_date ); } + /** + * @ticket 48145 + */ + function test_wp_insert_post_should_default_to_publish_if_post_date_is_within_59_seconds_from_current_time() { + $future_date = gmdate( 'Y-m-d H:i:s', time() + 59 ); + $post_id = self::factory()->post->create( + array( + 'post_date' => $future_date, + ) + ); + + $post = get_post( $post_id ); + $this->assertEquals( 'publish', $post->post_status ); + $this->assertEquals( $future_date, $post->post_date ); + } + /** * @ticket 22944 */