MDL-48837 phpunit: Restore system default timezone

This commit is contained in:
Ray Bon 2015-01-14 15:05:11 +08:00 committed by Rajesh Taneja
parent da0ef2e4cf
commit 914cad8793

View File

@ -33,6 +33,19 @@ require_once($CFG->dirroot . '/backup/util/helper/backup_cron_helper.class.php')
*/
class backup_cron_helper_testcase extends advanced_testcase {
/**
* @var String keep system default timezone.
*/
protected $systemdefaulttimezone;
/**
* Setup.
*/
protected function setUp() {
parent::setUp();
$this->systemdefaulttimezone = date_default_timezone_get();
}
/**
* Test {@link backup_cron_automated_helper::calculate_next_automated_backup}.
*/
@ -457,4 +470,12 @@ class backup_cron_helper_testcase extends advanced_testcase {
$this->assertEquals($expected, date('w-H:i', $next));
}
/**
* Set timezone back to default.
*/
protected function tearDown() {
date_default_timezone_set($this->systemdefaulttimezone);
parent::tearDown();
}
}