Date/Time: Add a unit test for [46968].

See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46969 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-12-17 14:35:25 +00:00
parent e8c854d2ce
commit 69ddf953bd

View File

@ -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
*/