diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-07-08 19:59:17 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-07-08 19:59:17 -0400 |
commit | f4fc02130ad7ee10f25baceb6bd00511d9de259d (patch) | |
tree | 40177d1b56af968117a53d1081b6e3a3a120b3af /tests/units/TaskDuplicationTest.php | |
parent | 61fb47bf3a595acf3c85707426890b2338b1d9b4 (diff) |
Fix bug: No creator when duplicating a task
Diffstat (limited to 'tests/units/TaskDuplicationTest.php')
-rw-r--r-- | tests/units/TaskDuplicationTest.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/units/TaskDuplicationTest.php b/tests/units/TaskDuplicationTest.php index cd791312..4e44fd75 100644 --- a/tests/units/TaskDuplicationTest.php +++ b/tests/units/TaskDuplicationTest.php @@ -15,6 +15,36 @@ use Model\Swimlane; class TaskDuplicationTest extends Base { + public function testThatDuplicateDefineCreator() + { + $td = new TaskDuplication($this->container); + $tc = new TaskCreation($this->container); + $tf = new TaskFinder($this->container); + $p = new Project($this->container); + + $this->assertEquals(1, $p->create(array('name' => 'test1'))); + $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); + + $task = $tf->getById(1); + $this->assertNotEmpty($task); + $this->assertEquals(1, $task['position']); + $this->assertEquals(1, $task['project_id']); + $this->assertEquals(0, $task['creator_id']); + + $_SESSION = array(); + $_SESSION['user']['id'] = 1; + + // We duplicate our task + $this->assertEquals(2, $td->duplicate(1)); + + // Check the values of the duplicated task + $task = $tf->getById(2); + $this->assertNotEmpty($task); + $this->assertEquals(1, $task['creator_id']); + + $_SESSION = array(); + } + public function testDuplicateSameProject() { $td = new TaskDuplication($this->container); |