summaryrefslogtreecommitdiff
path: root/tests/TaskTest.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fguillot@users.noreply.github.com>2014-04-27 19:48:36 -0400
committerFrédéric Guillot <fguillot@users.noreply.github.com>2014-04-27 19:48:36 -0400
commit12d7138a47d2c7a50ca8f0b2abb2266239c6197f (patch)
tree97e4024190d2cb09af9428993b76b77a82178a93 /tests/TaskTest.php
parent349b5f3f56f83d681fe6658c1a8475992dde9eea (diff)
Add support for the ISO 8601 date format (for due date)
Diffstat (limited to 'tests/TaskTest.php')
-rw-r--r--tests/TaskTest.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/TaskTest.php b/tests/TaskTest.php
index 701ba611..594d0e13 100644
--- a/tests/TaskTest.php
+++ b/tests/TaskTest.php
@@ -79,13 +79,19 @@ class TaskTest extends Base
{
$t = new Task($this->db, $this->event);
- $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'));
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->getValidDate('2014-03-05', 'Y-m-d')));
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->getValidDate('2014_03_05', 'Y_m_d')));
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->getValidDate('05/03/2014', 'd/m/Y')));
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->getValidDate('03/05/2014', 'm/d/Y')));
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->getValidDate('3/5/2014', 'm/d/Y')));
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->getValidDate('5/3/2014', 'd/m/Y')));
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->getValidDate('5/3/14', 'd/m/y')));
+ $this->assertEquals(0, $t->getValidDate('5/3/14', 'd/m/Y'));
+ $this->assertEquals(0, $t->getValidDate('5-3-2014', 'd/m/Y'));
+
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->parseDate('2014-03-05')));
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->parseDate('2014_03_05')));
+ $this->assertEquals('2014-03-05', date('Y-m-d', $t->parseDate('03/05/2014')));
}
public function testDuplicateTask()