diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-02-06 18:08:41 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-02-06 18:08:41 -0500 |
commit | 58cef289674717027b6b470044504a661f3bd9ad (patch) | |
tree | bf3be866b414009b60b1e1f16480a84c91da03de /tests/units/Helper/DatetimeHelperTest.php | |
parent | fc785bbbf6cc7db01964ae1d99cd02e85afeedc2 (diff) |
The date time format can be chosen in application settings
Diffstat (limited to 'tests/units/Helper/DatetimeHelperTest.php')
-rw-r--r-- | tests/units/Helper/DatetimeHelperTest.php | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/tests/units/Helper/DatetimeHelperTest.php b/tests/units/Helper/DatetimeHelperTest.php index 8e9c461b..f27a2eb9 100644 --- a/tests/units/Helper/DatetimeHelperTest.php +++ b/tests/units/Helper/DatetimeHelperTest.php @@ -6,23 +6,45 @@ use Kanboard\Helper\Dt; class DatetimeHelperTest extends Base { + public function testGetTime() + { + $helper = new Dt($this->container); + $this->assertEquals('17:25', $helper->time(1422206700)); + } + + public function testGetDate() + { + $helper = new Dt($this->container); + $this->assertEquals('01/25/2015', $helper->date(1422206700)); + $this->assertEquals('01/25/2015', $helper->date('2015-01-25')); + $this->assertEquals('', $helper->date('0')); + $this->assertEquals('', $helper->date(0)); + $this->assertEquals('', $helper->date('')); + } + + public function testGetDatetime() + { + $helper = new Dt($this->container); + $this->assertEquals('01/25/2015 17:25', $helper->datetime(1422206700)); + } + public function testAge() { - $h = new Dt($this->container); - - $this->assertEquals('<15m', $h->age(0, 30)); - $this->assertEquals('<30m', $h->age(0, 1000)); - $this->assertEquals('<1h', $h->age(0, 3000)); - $this->assertEquals('~2h', $h->age(0, 2*3600)); - $this->assertEquals('1d', $h->age(0, 30*3600)); - $this->assertEquals('2d', $h->age(0, 65*3600)); + $helper = new Dt($this->container); + + $this->assertEquals('<15m', $helper->age(0, 30)); + $this->assertEquals('<30m', $helper->age(0, 1000)); + $this->assertEquals('<1h', $helper->age(0, 3000)); + $this->assertEquals('~2h', $helper->age(0, 2*3600)); + $this->assertEquals('1d', $helper->age(0, 30*3600)); + $this->assertEquals('2d', $helper->age(0, 65*3600)); } public function testGetDayHours() { - $h = new Dt($this->container); + $helper = new Dt($this->container); - $slots = $h->getDayHours(); + $slots = $helper->getDayHours(); $this->assertNotEmpty($slots); $this->assertCount(48, $slots); @@ -36,9 +58,9 @@ class DatetimeHelperTest extends Base public function testGetWeekDays() { - $h = new Dt($this->container); + $helper = new Dt($this->container); - $slots = $h->getWeekDays(); + $slots = $helper->getWeekDays(); $this->assertNotEmpty($slots); $this->assertCount(7, $slots); @@ -48,9 +70,9 @@ class DatetimeHelperTest extends Base public function testGetWeekDay() { - $h = new Dt($this->container); + $helper = new Dt($this->container); - $this->assertEquals('Monday', $h->getWeekDay(1)); - $this->assertEquals('Sunday', $h->getWeekDay(7)); + $this->assertEquals('Monday', $helper->getWeekDay(1)); + $this->assertEquals('Sunday', $helper->getWeekDay(7)); } } |