summaryrefslogtreecommitdiff
path: root/tests/units/Model/TaskLinkModelTest.php
diff options
context:
space:
mode:
authorChristopher Geelen <christopher.geelen@vinotion.nl>2016-07-27 13:58:23 +0200
committerChristopher Geelen <christopher.geelen@vinotion.nl>2016-07-27 13:58:23 +0200
commit24745182724ca69092554eb5946e31584420f68a (patch)
tree386cdf7a8d7bf7ad2d80d938333bafbaf0fedcbc /tests/units/Model/TaskLinkModelTest.php
parent160c0b885eb4f1a1a1baa2b6b9fc6d99fdb80d0c (diff)
parent9649f7ba82ba7fe6a470abfe9f65e214cc68fa34 (diff)
Merge remote-tracking branch 'upstream/master'
Conflicts: app/Job/NotificationJob.php
Diffstat (limited to 'tests/units/Model/TaskLinkModelTest.php')
-rw-r--r--tests/units/Model/TaskLinkModelTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/units/Model/TaskLinkModelTest.php b/tests/units/Model/TaskLinkModelTest.php
index 78590891..01a7888b 100644
--- a/tests/units/Model/TaskLinkModelTest.php
+++ b/tests/units/Model/TaskLinkModelTest.php
@@ -9,6 +9,34 @@ use Kanboard\Model\ProjectModel;
class TaskLinkModelTest extends Base
{
+ public function testGeyById()
+ {
+ $taskLinkModel = new TaskLinkModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'A')));
+ $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'B')));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 6));
+
+ $taskLink = $taskLinkModel->getById(1);
+ $this->assertEquals(1, $taskLink['id']);
+ $this->assertEquals(1, $taskLink['task_id']);
+ $this->assertEquals(2, $taskLink['opposite_task_id']);
+ $this->assertEquals(6, $taskLink['link_id']);
+ $this->assertEquals(7, $taskLink['opposite_link_id']);
+ $this->assertEquals('is a child of', $taskLink['label']);
+
+ $taskLink = $taskLinkModel->getById(2);
+ $this->assertEquals(2, $taskLink['id']);
+ $this->assertEquals(2, $taskLink['task_id']);
+ $this->assertEquals(1, $taskLink['opposite_task_id']);
+ $this->assertEquals(7, $taskLink['link_id']);
+ $this->assertEquals(6, $taskLink['opposite_link_id']);
+ $this->assertEquals('is a parent of', $taskLink['label']);
+ }
+
// Check postgres issue: "Cardinality violation: 7 ERROR: more than one row returned by a subquery used as an expression"
public function testGetTaskWithMultipleMilestoneLink()
{