From 28a7f57d86c2c2fbef92da37eacb19980a133ed2 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 25 Jan 2015 18:55:11 -0500 Subject: Store due date without the time --- tests/units/DateParserTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/units') diff --git a/tests/units/DateParserTest.php b/tests/units/DateParserTest.php index e98fa6a5..5828fc48 100644 --- a/tests/units/DateParserTest.php +++ b/tests/units/DateParserTest.php @@ -29,4 +29,22 @@ class DateParserTest extends Base $this->assertEquals('2014-03-05', date('Y-m-d', $d->getTimestamp('2014_03_05'))); $this->assertEquals('2014-03-05', date('Y-m-d', $d->getTimestamp('03/05/2014'))); } + + public function testConvert() + { + $d = new DateParser($this->container); + + $values = array( + 'date_due' => '2015-01-25', + 'date_started' => '2015_01_25', + ); + + $d->convert($values, array('date_due', 'date_started')); + + $this->assertEquals(mktime(0, 0, 0, 1, 25, 2015), $values['date_due']); + $this->assertEquals('2015-01-25', date('Y-m-d', $values['date_due'])); + + $this->assertEquals(mktime(0, 0, 0, 1, 25, 2015), $values['date_started']); + $this->assertEquals('2015-01-25', date('Y-m-d', $values['date_started'])); + } } -- cgit v1.2.3