diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-02-23 12:33:15 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-03-03 09:08:47 +0100 |
commit | 276d67808013927c8777ffd92a2cbe09285f449f (patch) | |
tree | b93f9ea225624e4a648076766e88afc6e7067a48 /tests | |
parent | e271fa3ee8b1ce13940a33ec7266cee345323e2d (diff) | |
download | nextcloud-server-276d67808013927c8777ffd92a2cbe09285f449f.tar.gz nextcloud-server-276d67808013927c8777ffd92a2cbe09285f449f.zip |
Etc timezones don't exist for .5 and .75 offsets
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/util.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/lib/util.php b/tests/lib/util.php index 6870b218076..a852eee8ad6 100644 --- a/tests/lib/util.php +++ b/tests/lib/util.php @@ -52,16 +52,31 @@ class Test_Util extends \Test\TestCase { OC_Util::formatDate(1350129205, false, 'Mordor/Barad-dûr'); } - function testFormatDateWithTZFromSession() { + 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(3.5, 'October 13, 2012 at 3:23:25 PM GMT+3:30'), + 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'), + ); + } + + /** + * @dataProvider formatDateWithTZFromSessionData + */ + function testFormatDateWithTZFromSession($offset, $expected) { date_default_timezone_set("UTC"); $oldDateTimeFormatter = \OC::$server->query('DateTimeFormatter'); - \OC::$server->getSession()->set('timezone', 3); + \OC::$server->getSession()->set('timezone', $offset); $newDateTimeFormatter = new \OC\DateTimeFormatter(\OC::$server->getDateTimeZone()->getTimeZone(), new \OC_L10N('lib', 'en')); $this->setDateFormatter($newDateTimeFormatter); $result = OC_Util::formatDate(1350129205, false); - $expected = 'October 13, 2012 at 2:53:25 PM GMT+3'; $this->assertEquals($expected, $result); $this->setDateFormatter($oldDateTimeFormatter); |