From accd6187e264def384d762ac26c83f95a49b89ab Mon Sep 17 00:00:00 2001 From: nathangray Date: Fri, 20 Oct 2017 09:56:47 +0200 Subject: [PATCH] Get date widget duration test working again --- api/src/Etemplate/Widget/tests/DateTest.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/src/Etemplate/Widget/tests/DateTest.php b/api/src/Etemplate/Widget/tests/DateTest.php index cce7271280..114586d352 100644 --- a/api/src/Etemplate/Widget/tests/DateTest.php +++ b/api/src/Etemplate/Widget/tests/DateTest.php @@ -72,13 +72,18 @@ class DateTest extends \EGroupware\Api\Etemplate\WidgetBaseTest public function basicProvider() { - $now = new DateTime(time()); + // Reset server timezone here, as it tends to go back to php.ini value + DateTime::$server_timezone = new \DateTimeZone('UTC'); + + $now = new DateTime(time(),DateTime::$server_timezone); $now->setTime(22, 13, 20); // Just because 80000 seconds after epoch is 22:13:20 $today = clone $now; $today->setTime(0,0); - $time = new DateTime(80000); // 22:13:20 + $time = new DateTime('1970-01-01',new \DateTimeZone('UTC')); + $time->setTime(22, 13, 20); // Just because 80000 seconds after epoch is 22:13:20 + $data = array( array( array('date' => $today->getTimestamp(), 'date_time' => $today->getTimestamp()),