Skip to content

Commit

Permalink
MDL-48837 phpunit: Restore system default timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
rbonatuvic authored and Rajesh Taneja committed Jan 16, 2015
1 parent da0ef2e commit 914cad8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions backup/util/helper/tests/cronhelper_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@
*/
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}.
*/
Expand Down Expand Up @@ -457,4 +470,12 @@ public function test_next_automated_backup() {
$this->assertEquals($expected, date('w-H:i', $next));

}

/**
* Set timezone back to default.
*/
protected function tearDown() {
date_default_timezone_set($this->systemdefaulttimezone);
parent::tearDown();
}
}

0 comments on commit 914cad8

Please sign in to comment.