diff options
| author | Andreas Fischer <bantu@phpbb.com> | 2014-10-01 02:15:25 +0200 |
|---|---|---|
| committer | Andreas Fischer <bantu@phpbb.com> | 2014-10-01 02:15:25 +0200 |
| commit | 8fef959418fa43e04be051012c97657225644893 (patch) | |
| tree | c8a77dd9b8caac8eae8f05c8e15b218658139e98 | |
| parent | a8e74fff9bc73342f95b5e863bc7cc7894b37f8a (diff) | |
| parent | f30c5f730e0ae68d4090da781a41e081c8e0c28f (diff) | |
| download | forums-8fef959418fa43e04be051012c97657225644893.tar forums-8fef959418fa43e04be051012c97657225644893.tar.gz forums-8fef959418fa43e04be051012c97657225644893.tar.bz2 forums-8fef959418fa43e04be051012c97657225644893.tar.xz forums-8fef959418fa43e04be051012c97657225644893.zip | |
Merge pull request #3011 from fredemmott/ticket/13122
[ticket/13122] Make phpbb_wrapper_gmgetdate_test more reliable
* fredemmott/ticket/13122:
[ticket/13122] Make phpbb_wrapper_gmgetdate_test more reliable
| -rw-r--r-- | tests/wrapper/gmgetdate_test.php | 13 |
1 files changed, 12 insertions, 1 deletions
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)) { |
