summaryrefslogtreecommitdiff
path: root/tests/units/Model/TimezoneTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/Model/TimezoneTest.php')
-rw-r--r--tests/units/Model/TimezoneTest.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/units/Model/TimezoneTest.php b/tests/units/Model/TimezoneTest.php
new file mode 100644
index 00000000..ac2cd6a1
--- /dev/null
+++ b/tests/units/Model/TimezoneTest.php
@@ -0,0 +1,32 @@
+<?php
+
+require_once __DIR__.'/../Base.php';
+
+use Kanboard\Model\Timezone;
+
+class TimezoneTest extends Base
+{
+ public function testGetTimezones()
+ {
+ $timezoneModel = new Timezone($this->container);
+ $this->assertNotEmpty($timezoneModel->getTimezones());
+ $this->assertArrayHasKey('Europe/Paris', $timezoneModel->getTimezones());
+ $this->assertContains('Europe/Paris', $timezoneModel->getTimezones());
+ $this->assertArrayNotHasKey('', $timezoneModel->getTimezones());
+
+ $this->assertArrayHasKey('', $timezoneModel->getTimezones(true));
+ $this->assertContains('Application default', $timezoneModel->getTimezones(true));
+ }
+
+ public function testGetCurrentTimezone()
+ {
+ $timezoneModel = new Timezone($this->container);
+ $this->assertEquals('UTC', $timezoneModel->getCurrentTimezone());
+
+ $this->container['sessionStorage']->user = array('timezone' => 'Europe/Paris');
+ $this->assertEquals('Europe/Paris', $timezoneModel->getCurrentTimezone());
+
+ $this->container['sessionStorage']->user = array('timezone' => 'Something');
+ $this->assertEquals('Something', $timezoneModel->getCurrentTimezone());
+ }
+}