summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-11-15 15:04:12 -0800
committerFrederic Guillot <fred@kanboard.net>2017-11-15 15:05:06 -0800
commit765cb42725f6035ea33dbcdee103ebefef562ed9 (patch)
treeea3c921813e6c0ca4962a9792b5a246a7adee591 /tests
parente03f5d17f0a80d6140030275d37ac48ea3230c66 (diff)
parent0c378e2b5186175dd664145dcb9f83498c78b929 (diff)
Solve conflict in PR #3113
Diffstat (limited to 'tests')
-rw-r--r--tests/units/Validator/TaskValidatorTest.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/units/Validator/TaskValidatorTest.php b/tests/units/Validator/TaskValidatorTest.php
index fd5e41fe..12c5a497 100644
--- a/tests/units/Validator/TaskValidatorTest.php
+++ b/tests/units/Validator/TaskValidatorTest.php
@@ -80,5 +80,52 @@ class TaskValidatorTest extends Base
$result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '09/11/2017 10:50', 'date_started' => '09/11/2017 11:50'));
$this->assertFalse($result[0]);
+
+ // date_due
+ // ISO dates
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '2017-02-01'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '2017-02-01 13:15'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '2017-02-01 1:15 pm'));
+ $this->assertFalse($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '2017_02_01'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '2017_02_01 13:15'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '2017_02_01 1:15 am'));
+ $this->assertFalse($result[0]);
+
+ // d/m/Y dates
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '02/01/2017'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '02/01/2017 13:15'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '02/01/2017 1:15 pm'));
+ $this->assertFalse($result[0]);
+
+
+ // date_started
+ // ISO dates
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_started' => '2017-02-01'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_started' => '2017-02-01 13:15'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_started' => '2017-02-01 1:15 pm'));
+ $this->assertFalse($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_started' => '2017_02_01'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_started' => '2017_02_01 13:15'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_started' => '2017_02_01 1:15 pm'));
+ $this->assertFalse($result[0]);
+
+ // d/m/Y dates
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_started' => '02/01/2017'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_started' => '02/01/2017 13:15'));
+ $this->assertTrue($result[0]);
+ $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_started' => '02/01/2017 1:15 pm'));
+ $this->assertFalse($result[0]);
}
}