Set timezone in PHP too

This commit is contained in:
nathangray 2017-10-17 16:08:17 +02:00
parent 88a3f3b1d4
commit 7ac36666c5

View File

@ -19,6 +19,8 @@ use Egroupware\Api;
class TimezoneTest extends \EGroupware\Api\AppTest { class TimezoneTest extends \EGroupware\Api\AppTest {
protected static $server_tz;
protected $bo; protected $bo;
const RECUR_DAYS = 5; const RECUR_DAYS = 5;
@ -29,9 +31,13 @@ class TimezoneTest extends \EGroupware\Api\AppTest {
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
parent::setUpBeforeClass(); parent::setUpBeforeClass();
static::$server_tz = date_default_timezone_get();
} }
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
date_default_timezone_set(static::$server_tz);
parent::tearDownAfterClass(); parent::tearDownAfterClass();
} }
@ -336,6 +342,7 @@ class TimezoneTest extends \EGroupware\Api\AppTest {
protected function setTimezones($timezones) protected function setTimezones($timezones)
{ {
// Set the client preference & server preference // Set the client preference & server preference
date_default_timezone_set($timezones['server']);
$GLOBALS['egw_info']['server']['server_timezone'] = $timezones['server']; $GLOBALS['egw_info']['server']['server_timezone'] = $timezones['server'];
$GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $timezones['client']; $GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $timezones['client'];