diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-10-01 09:46:34 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-10-01 09:46:34 -0400 |
commit | 370361330aeb37f02e87ab78ae38521da774c957 (patch) | |
tree | dafef9c946d278a9acc99947af6212bb5c25f1c0 /tests/units/Model/TaskLinkTest.php | |
parent | 792d5a20bcb4926c91311afced67ddd008c3b79e (diff) |
Fix Postgres issue "Cardinality violation" when there is multiple "is_milestone_of" links
Diffstat (limited to 'tests/units/Model/TaskLinkTest.php')
-rw-r--r-- | tests/units/Model/TaskLinkTest.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/units/Model/TaskLinkTest.php b/tests/units/Model/TaskLinkTest.php index 1e79ea74..fed03334 100644 --- a/tests/units/Model/TaskLinkTest.php +++ b/tests/units/Model/TaskLinkTest.php @@ -3,12 +3,33 @@ require_once __DIR__.'/../Base.php'; use Model\Link; +use Model\TaskFinder; use Model\TaskLink; use Model\TaskCreation; use Model\Project; class TaskLinkTest extends Base { + // Check postgres issue: "Cardinality violation: 7 ERROR: more than one row returned by a subquery used as an expression" + public function testGetTaskWithMultipleMilestoneLink() + { + $tf = new TaskFinder($this->container); + $tl = new TaskLink($this->container); + $p = new Project($this->container); + $tc = new TaskCreation($this->container); + + $this->assertEquals(1, $p->create(array('name' => 'test'))); + $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A'))); + $this->assertEquals(2, $tc->create(array('project_id' => 1, 'title' => 'B'))); + $this->assertEquals(3, $tc->create(array('project_id' => 1, 'title' => 'C'))); + + $this->assertNotFalse($tl->create(1, 2, 9)); + $this->assertNotFalse($tl->create(1, 3, 9)); + + $task = $tf->getExtendedQuery()->findOne(); + $this->assertNotEmpty($task); + } + public function testCreateTaskLinkWithNoOpposite() { $tl = new TaskLink($this->container); |