summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/TaskCreationTest.php22
-rw-r--r--tests/units/TaskDuplicationTest.php30
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/units/TaskCreationTest.php b/tests/units/TaskCreationTest.php
index 3dd2b714..03a85b64 100644
--- a/tests/units/TaskCreationTest.php
+++ b/tests/units/TaskCreationTest.php
@@ -175,6 +175,28 @@ class TaskCreationTest extends Base
$this->assertEquals(1, $task['creator_id']);
}
+ public function testThatCreatorIsDefined()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $_SESSION = array();
+ $_SESSION['user']['id'] = 1;
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test')));
+
+ $task = $tf->getById(1);
+ $this->assertNotEmpty($task);
+ $this->assertNotFalse($task);
+
+ $this->assertEquals(1, $task['id']);
+ $this->assertEquals(1, $task['creator_id']);
+
+ $_SESSION = array();
+ }
+
public function testColumnId()
{
$p = new Project($this->container);
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);