MDL-38840 Statslib - Fix failing unit tests on ci server (DST change)

This commit is contained in:
Damyon Wiese 2013-04-02 22:00:56 +08:00 committed by Eloy Lafuente (stronk7)
parent 871da25a40
commit 594d66c27e

View File

@ -328,7 +328,8 @@ class statslib_daily_testcase extends advanced_testcase {
$CFG->statsfirstrun = 'all';
// Allow 1 second difference in case we cross a second boundary.
$this->assertLessThanOrEqual(1, stats_get_start_from('daily') - ($time - (3 * 24 * 3600)), 'All start time');
// Note: within 3 days of a DST change - -3 days != 3 * 24 hours (it may be more or less).
$this->assertLessThanOrEqual(1, stats_get_start_from('daily') - strtotime('-3 days', $time), 'All start time');
$this->prepare_db($dataset[0], array('log'));
$records = $DB->get_records('log');
@ -336,7 +337,7 @@ class statslib_daily_testcase extends advanced_testcase {
$this->assertEquals($day + 14410, stats_get_start_from('daily'), 'Log entry start');
$CFG->statsfirstrun = 'none';
$this->assertLessThanOrEqual(1, stats_get_start_from('daily') - ($time - (3 * 24 * 3600)), 'None start time');
$this->assertLessThanOrEqual(1, stats_get_start_from('daily') - strtotime('-3 days', $time), 'None start time');
$CFG->statsfirstrun = 14515200;
$this->assertLessThanOrEqual(1, stats_get_start_from('daily') - ($time - (14515200)), 'Specified start time');