mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-20 21:08:54 +01:00
Run test in UTC, so dates match our expectations
This commit is contained in:
parent
6fad74c710
commit
88a3f3b1d4
@ -22,6 +22,7 @@ use PHPUnit\Framework\TestCase as TestCase;
|
|||||||
class DateTimeTest extends TestCase {
|
class DateTimeTest extends TestCase {
|
||||||
|
|
||||||
protected static $usertime;
|
protected static $usertime;
|
||||||
|
protected static $server_tz;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work in server time, so tests match expectations
|
* Work in server time, so tests match expectations
|
||||||
@ -32,6 +33,13 @@ class DateTimeTest extends TestCase {
|
|||||||
|
|
||||||
static::$usertime = DateTime::$user_timezone;
|
static::$usertime = DateTime::$user_timezone;
|
||||||
|
|
||||||
|
static::$server_tz = date_default_timezone_get();
|
||||||
|
|
||||||
|
// Set time to UTC time for consistency
|
||||||
|
DateTime::setUserPrefs('UTC');
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
DateTime::$server_timezone = new \DateTimeZone('UTC');
|
||||||
|
|
||||||
// Set user time to server time for consistency
|
// Set user time to server time for consistency
|
||||||
DateTime::setUserPrefs(date_default_timezone_get());
|
DateTime::setUserPrefs(date_default_timezone_get());
|
||||||
}
|
}
|
||||||
@ -39,6 +47,7 @@ class DateTimeTest extends TestCase {
|
|||||||
{
|
{
|
||||||
// Reset
|
// Reset
|
||||||
DateTime::setUserPrefs(static::$usertime->getName());
|
DateTime::setUserPrefs(static::$usertime->getName());
|
||||||
|
date_default_timezone_set(static::$server_tz);
|
||||||
|
|
||||||
unset($GLOBALS['egw']);
|
unset($GLOBALS['egw']);
|
||||||
parent::tearDownAfterClass();
|
parent::tearDownAfterClass();
|
||||||
|
Loading…
Reference in New Issue
Block a user