From 99ddfa019523e1440587094b8569bbe5e5474448 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 17 Dec 2019 21:31:08 +0000 Subject: [PATCH] Tests: Use delta comparison in `test_should_fall_back_to_last_post_modified()` to avoid race conditions. See #48957. git-svn-id: https://develop.svn.wordpress.org/trunk@46981 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/date/getFeedBuildDate.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/tests/date/getFeedBuildDate.php b/tests/phpunit/tests/date/getFeedBuildDate.php index 455bfa0b80..afe5bbd1fa 100644 --- a/tests/phpunit/tests/date/getFeedBuildDate.php +++ b/tests/phpunit/tests/date/getFeedBuildDate.php @@ -61,9 +61,10 @@ class Tests_Date_Get_Feed_Build_Date extends WP_UnitTestCase { ); $this->assertEquals( - $datetime_utc->format( DATE_RFC3339 ), - get_feed_build_date( DATE_RFC3339 ), - 'Fall back to time of last post modified with no posts' + strtotime( $datetime_utc->format( DATE_RFC3339 ) ), + strtotime( get_feed_build_date( DATE_RFC3339 ) ), + 'Fall back to time of last post modified with no posts', + 2 ); $post_id_broken = $this->factory->post->create(); @@ -74,9 +75,10 @@ class Tests_Date_Get_Feed_Build_Date extends WP_UnitTestCase { $wp_query->posts = array( $post_broken ); $this->assertEquals( - $datetime_utc->format( DATE_RFC3339 ), - get_feed_build_date( DATE_RFC3339 ), - 'Fall back to time of last post modified with broken post object' + strtotime( $datetime_utc->format( DATE_RFC3339 ) ), + strtotime( get_feed_build_date( DATE_RFC3339 ) ), + 'Fall back to time of last post modified with broken post object', + 2 ); } }