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
This commit is contained in:
parent
a276995ff9
commit
99ddfa0195
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user