summaryrefslogtreecommitdiffstats
path: root/tests/lib/util.php
diff options
context:
space:
mode:
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);