diff options
author | Frédéric Guillot <contact@fredericguillot.com> | 2014-03-05 22:27:48 -0500 |
---|---|---|
committer | Frédéric Guillot <contact@fredericguillot.com> | 2014-03-05 22:27:48 -0500 |
commit | 544f9924241f9b2caaf83ead203161ea41e5f1cf (patch) | |
tree | dcb5ba8a202fee673e395184795f570fd7c905ae /tests/TaskTest.php | |
parent | 1e994f34486da72662ff39f1c3e130e4480e30ab (diff) |
Add a 'due date' field and display the number of comments on the board
Diffstat (limited to 'tests/TaskTest.php')
-rw-r--r-- | tests/TaskTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/TaskTest.php b/tests/TaskTest.php new file mode 100644 index 00000000..415faede --- /dev/null +++ b/tests/TaskTest.php @@ -0,0 +1,27 @@ +<?php + +require_once __DIR__.'/../models/base.php'; +require_once __DIR__.'/../models/task.php'; + +use Model\Task; + +class TaskTest extends PHPUnit_Framework_TestCase +{ + public function setUp() + { + defined('DB_FILENAME') or define('DB_FILENAME', ':memory:'); + } + + public function testDateFormat() + { + $t = new Task; + + $this->assertEquals('2014-03-05', date('Y-m-d', $t->getTimestampFromDate('05/03/2014', 'd/m/Y'))); + $this->assertEquals('2014-03-05', date('Y-m-d', $t->getTimestampFromDate('03/05/2014', 'm/d/Y'))); + $this->assertEquals('2014-03-05', date('Y-m-d', $t->getTimestampFromDate('3/5/2014', 'm/d/Y'))); + $this->assertEquals('2014-03-05', date('Y-m-d', $t->getTimestampFromDate('5/3/2014', 'd/m/Y'))); + $this->assertEquals('2014-03-05', date('Y-m-d', $t->getTimestampFromDate('5/3/14', 'd/m/y'))); + $this->assertEquals(0, $t->getTimestampFromDate('5/3/14', 'd/m/Y')); + $this->assertEquals(0, $t->getTimestampFromDate('5-3-2014', 'd/m/Y')); + } +} |