mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Date/Time: Use delta comparison in get_gmt_from_date()
tests to avoid race conditions.
Follow-up to [35284]. Props keesiemeijer. Merges [41920] to the 4.4 branch. See #38815. git-svn-id: https://develop.svn.wordpress.org/branches/4.4@51616 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
50b33f3dcc
commit
54496bf8b4
@ -81,8 +81,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
function test_get_gmt_from_date_string_date() {
|
||||
update_option( 'timezone_string', 'Europe/London' );
|
||||
$local = 'now';
|
||||
$gmt = gmdate( 'Y-m-d H:i:s', strtotime( 'now' ) );
|
||||
$this->assertEquals( $gmt, get_gmt_from_date( $local ) );
|
||||
$gmt = gmdate( 'Y-m-d H:i:s' );
|
||||
$this->assertEquals( strtotime( $gmt ), strtotime( get_gmt_from_date( $local ) ), 'The dates should be equal', 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +90,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
*/
|
||||
function test_get_gmt_from_date_string_date_no_timezone() {
|
||||
$local = 'now';
|
||||
$gmt = gmdate( 'Y-m-d H:i:s', strtotime( 'now' ) );
|
||||
$this->assertEquals( $gmt, get_gmt_from_date( $local ) );
|
||||
$gmt = gmdate( 'Y-m-d H:i:s' );
|
||||
$this->assertEquals( strtotime( $gmt ), strtotime( get_gmt_from_date( $local ) ), 'The dates should be equal', 2 );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user