diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-08-31 21:32:29 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-08-31 21:32:29 -0400 |
commit | 1b6b1cc5e6e26a3e3081cdd9613508a66c3751ee (patch) | |
tree | 10a791ad38fc73f642dff26d1a88223de6abed7c /tests/units/Core | |
parent | 0cb717f4407b81868d6b909d1d4ef4795c5e4b50 (diff) |
Time spent for subtasks are not rounded too the nearest quarter anymore
Diffstat (limited to 'tests/units/Core')
-rw-r--r-- | tests/units/Core/DateParserTest.php | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/tests/units/Core/DateParserTest.php b/tests/units/Core/DateParserTest.php index ee4e2d54..1cf98bd3 100644 --- a/tests/units/Core/DateParserTest.php +++ b/tests/units/Core/DateParserTest.php @@ -166,17 +166,9 @@ class DateParserTest extends Base $this->assertEquals(1, $dateParser->getHours(new DateTime('2015-03-14 15:00:00'), new DateTime('2015-03-14 16:00:00'))); $this->assertEquals(2.5, $dateParser->getHours(new DateTime('2015-03-14 15:00:00'), new DateTime('2015-03-14 17:30:00'))); $this->assertEquals(2.75, $dateParser->getHours(new DateTime('2015-03-14 15:00:00'), new DateTime('2015-03-14 17:45:00'))); - $this->assertEquals(3, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 17:58:00'))); - $this->assertEquals(3, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 11:58:00'))); - } - - public function testRoundSeconds() - { - $dateParser = new DateParser($this->container); - $this->assertEquals('16:30', date('H:i', $dateParser->getRoundedSeconds(strtotime('16:28')))); - $this->assertEquals('16:00', date('H:i', $dateParser->getRoundedSeconds(strtotime('16:02')))); - $this->assertEquals('16:15', date('H:i', $dateParser->getRoundedSeconds(strtotime('16:14')))); - $this->assertEquals('17:00', date('H:i', $dateParser->getRoundedSeconds(strtotime('16:58')))); + $this->assertEquals(3.02, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 17:58:00'))); + $this->assertEquals(2.98, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 11:58:00'))); + $this->assertEquals(0, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 14:57:10'))); } public function testGetIsoDate() |