diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/datetime/from_format_test.php | 2 | ||||
-rw-r--r-- | tests/wrapper/gmgetdate_test.php | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php index 0f87abc180..f10402e8cb 100644 --- a/tests/datetime/from_format_test.php +++ b/tests/datetime/from_format_test.php @@ -60,7 +60,7 @@ class phpbb_datetime_from_format_test extends phpbb_test_case // If the current time is too close to the testing time, // the relative time will use "x minutes ago" instead of "today ..." // So we use 18:01 in the morning and 06:01 in the afternoon. - $testing_time = date('H') <= 12 ? '06:01' : '18:01'; + $testing_time = date('H') <= 12 ? '18:01' : '06:01'; return array( array( diff --git a/tests/wrapper/gmgetdate_test.php b/tests/wrapper/gmgetdate_test.php index dc0e38544d..2e55a78d21 100644 --- a/tests/wrapper/gmgetdate_test.php +++ b/tests/wrapper/gmgetdate_test.php @@ -50,7 +50,18 @@ class phpbb_wrapper_gmgetdate_test extends phpbb_test_case $date_array['year'] ); - $this->assertEquals($expected, $actual); + // Calling second-granularity time functions twice isn't guaranteed to + // give the same results. As long as they're in the right order, allow + // a 1 second difference. + $this->assertGreaterThanOrEqual( + $expected, $actual, + 'Expected second time to be after (or equal to) the previous one' + ); + $this->assertLessThanOrEqual( + 1, + abs($actual - $expected), + "Expected $actual to be within 1 second of $expected." + ); if (isset($current_timezone)) { |