aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/util.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-09-23 13:45:21 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-09-23 13:45:21 +0200
commitc587a4aaa212a48aca0b34fc2f9625774e02c472 (patch)
tree125b5ba8c98d5137e63e71c003135a9b338586d9 /tests/lib/util.php
parenta062db4fd02feb1a0eff48eb130da7cc48c49899 (diff)
parent814114ab8eda5d383f4c620f3854cfefcdb6895d (diff)
downloadnextcloud-server-c587a4aaa212a48aca0b34fc2f9625774e02c472.tar.gz
nextcloud-server-c587a4aaa212a48aca0b34fc2f9625774e02c472.zip
Merge pull request #11222 from owncloud/store-users-timezone-master
send browsers timezone back tp the server on login
Diffstat (limited to 'tests/lib/util.php')
-rw-r--r--tests/lib/util.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/util.php b/tests/lib/util.php
index 999c62486a7..600b794d8b8 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -37,6 +37,30 @@ class Test_Util extends PHPUnit_Framework_TestCase {
$this->assertEquals($expected, $result);
}
+ function testFormatDateWithTZ() {
+ date_default_timezone_set("UTC");
+
+ $result = OC_Util::formatDate(1350129205, false, 'Europe/Berlin');
+ $expected = 'October 13, 2012 13:53';
+ $this->assertEquals($expected, $result);
+ }
+
+ /**
+ * @expectedException Exception
+ */
+ function testFormatDateWithInvalidTZ() {
+ OC_Util::formatDate(1350129205, false, 'Mordor/Barad-dûr');
+ }
+
+ function testFormatDateWithTZFromSession() {
+ date_default_timezone_set("UTC");
+
+ \OC::$server->getSession()->set('timezone', 3);
+ $result = OC_Util::formatDate(1350129205, false);
+ $expected = 'October 13, 2012 14:53';
+ $this->assertEquals($expected, $result);
+ }
+
function testCallRegister() {
$result = strlen(OC_Util::callRegister());
$this->assertEquals(30, $result);