summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-08-31 21:04:22 -0400
committerFrederic Guillot <fred@kanboard.net>2016-08-31 21:04:22 -0400
commit3861e90336031873d7f6dc2f7476b5502af7d69f (patch)
tree6cfcf590b3dd307e639025e5cd272d57232245ba /tests/units
parent12acf66ad2a2673dd3201c85d4179b6c46f3c12f (diff)
Fix wrong project date format (shown as 01/01/1970)
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/Core/DateParserTest.php3
-rw-r--r--tests/units/Model/ProjectModelTest.php18
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/units/Core/DateParserTest.php b/tests/units/Core/DateParserTest.php
index fbde8bd5..ee4e2d54 100644
--- a/tests/units/Core/DateParserTest.php
+++ b/tests/units/Core/DateParserTest.php
@@ -212,6 +212,9 @@ class DateParserTest extends Base
$this->assertEquals(array('date' => '06/02/2016'), $dateParser->format($values, array('date'), 'd/m/Y'));
$this->assertEquals(array('date' => '02/06/2016 7:30 pm'), $dateParser->format($values, array('date'), 'm/d/Y g:i a'));
+
+ $values['date'] = '2016-02-06';
+ $this->assertEquals(array('date' => '06/02/2016'), $dateParser->format($values, array('date'), 'd/m/Y'));
}
public function testConvert()
diff --git a/tests/units/Model/ProjectModelTest.php b/tests/units/Model/ProjectModelTest.php
index 81e0dd57..cd86b654 100644
--- a/tests/units/Model/ProjectModelTest.php
+++ b/tests/units/Model/ProjectModelTest.php
@@ -39,6 +39,24 @@ class ProjectModelTest extends Base
$this->assertEquals(0, $project['is_private']);
$this->assertEquals(time(), $project['last_modified'], '', 1);
$this->assertEmpty($project['token']);
+ $this->assertEmpty($project['start_date']);
+ $this->assertEmpty($project['end_date']);
+ }
+
+ public function testProjectDate()
+ {
+ $projectModel = new ProjectModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest')));
+ $this->assertTrue($projectModel->update(array(
+ 'id' => 1,
+ 'start_date' => '2016-08-31',
+ 'end_date' => '08/31/2016',
+ )));
+
+ $project = $projectModel->getById(1);
+ $this->assertEquals('2016-08-31', $project['start_date']);
+ $this->assertEquals('2016-08-31', $project['end_date']);
}
public function testCreationWithDuplicateName()