summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-04-07 10:13:51 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-04-07 10:16:47 +0200
commit628bb3fb3ec3f3343d869cfe31c84d1b6e221369 (patch)
treea520023610f980e72de1f8438a69b37106df20c1
parentdfd302178a654aaafa23d137214b8533427b2b42 (diff)
downloadnextcloud-server-628bb3fb3ec3f3343d869cfe31c84d1b6e221369.tar.gz
nextcloud-server-628bb3fb3ec3f3343d869cfe31c84d1b6e221369.zip
Select the timezone on the right timestamp and assert it
-rw-r--r--tests/lib/util.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/lib/util.php b/tests/lib/util.php
index e77aa53b72d..5fc5e87807f 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -54,24 +54,27 @@ class Test_Util extends \Test\TestCase {
public function formatDateWithTZFromSessionData() {
return array(
- array(3, 'October 13, 2012 at 2:53:25 PM GMT+3'),
- array(15, 'October 13, 2012 at 11:53:25 AM GMT+0'),
- array(-13, 'October 13, 2012 at 11:53:25 AM GMT+0'),
- array(9.5, 'October 13, 2012 at 9:23:25 PM GMT+9:30'),
- array(-4.5, 'October 13, 2012 at 7:23:25 AM GMT-4:30'),
- array(15.5, 'October 13, 2012 at 11:53:25 AM GMT+0'),
+ array(3, 'October 13, 2012 at 2:53:25 PM GMT+3', 'Etc/GMT-3'),
+ array(15, 'October 13, 2012 at 11:53:25 AM GMT+0', 'UTC'),
+ array(-13, 'October 13, 2012 at 11:53:25 AM GMT+0', 'UTC'),
+ array(9.5, 'October 13, 2012 at 9:23:25 PM GMT+9:30', 'Australia/Darwin'),
+ array(-4.5, 'October 13, 2012 at 7:23:25 AM GMT-4:30', 'America/Caracas'),
+ array(15.5, 'October 13, 2012 at 11:53:25 AM GMT+0', 'UTC'),
);
}
/**
* @dataProvider formatDateWithTZFromSessionData
*/
- function testFormatDateWithTZFromSession($offset, $expected) {
+ function testFormatDateWithTZFromSession($offset, $expected, $expectedTimeZone) {
date_default_timezone_set("UTC");
$oldDateTimeFormatter = \OC::$server->query('DateTimeFormatter');
\OC::$server->getSession()->set('timezone', $offset);
- $newDateTimeFormatter = new \OC\DateTimeFormatter(\OC::$server->getDateTimeZone()->getTimeZone(), new \OC_L10N('lib', 'en'));
+
+ $selectedTimeZone = \OC::$server->getDateTimeZone()->getTimeZone(1350129205);
+ $this->assertEquals($expectedTimeZone, $selectedTimeZone->getName());
+ $newDateTimeFormatter = new \OC\DateTimeFormatter($selectedTimeZone, new \OC_L10N('lib', 'en'));
$this->setDateFormatter($newDateTimeFormatter);
$result = OC_Util::formatDate(1350129205, false);