summaryrefslogtreecommitdiff
path: root/tests/units/TaskFilterTest.php
diff options
context:
space:
mode:
authorLesstat <florianbarth@gmx.de>2015-07-11 11:38:04 +0200
committerLesstat <florianbarth@gmx.de>2015-07-11 11:38:04 +0200
commit5101eaa8060ce3c75a81a26f6e47aae40e3d4ac3 (patch)
treecdd9fb31e9dbcf030ce2439de7078ddc9f555f66 /tests/units/TaskFilterTest.php
parente7b967d7432267d48e54d7775d0baf1e411178e7 (diff)
Included Subtask when filtering Tasks by Assignee
I wrote some unit test specifing the behaviour. I think only Substask with a Status != Done and an assigned user should be taken into account. The search for "nobody" should not reveal tasks with assigned users when these tasks have a subtask without an user.
Diffstat (limited to 'tests/units/TaskFilterTest.php')
-rw-r--r--tests/units/TaskFilterTest.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/units/TaskFilterTest.php b/tests/units/TaskFilterTest.php
index af00b6fa..80d15484 100644
--- a/tests/units/TaskFilterTest.php
+++ b/tests/units/TaskFilterTest.php
@@ -8,6 +8,7 @@ use Model\TaskFilter;
use Model\TaskCreation;
use Model\DateParser;
use Model\Category;
+use Model\Subtask;
class TaskFilterTest extends Base
{
@@ -418,6 +419,41 @@ class TaskFilterTest extends Base
$this->assertEquals('Bob at work', $tasks[1]['title']);
}
+ public function testSearchWithAssigneeIncludingSubtasks()
+ {
+ $p = new Project($this->container);
+ $u = new User($this->container);
+ $tc = new TaskCreation($this->container);
+ $s = new Subtask($this->container);
+ $tf = new TaskFilter($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(2, $u->create(array('username' => 'bob', 'name' => 'Bob Ryan')));
+ $this->assertEquals(1,$tc->create(array('project_id' => 1, 'title' => 'my task title is awesome', 'owner_id' => 2)));
+ $this->assertEquals(1, $s->create(array('title' => 'subtask #1', 'task_id' => 1, 'status' => 1, 'another_subtask' => 'on', 'user_id' => 0)));
+ $this->assertEquals(2,$tc->create(array('project_id' => 1, 'title' => 'my task title is amazing', 'owner_id' => 0)));
+ $this->assertEquals(2, $s->create(array('title' => 'subtask #1', 'task_id' => 2, 'status' => 1, 'another_subtask' => 'on', 'user_id' => 2)));
+
+ $tf->search('assignee:bob');
+ $tasks = $tf->findAll();
+ $this->assertNotEmpty($tasks);
+ $this->assertCount(2, $tasks);
+ $this->assertEquals('my task title is awesome', $tasks[0]['title']);
+ $this->assertEquals('my task title is amazing', $tasks[1]['title']);
+
+
+ $tf->search('assignee:nobody');
+ $tasks = $tf->findAll();
+ $this->assertNotEmpty($tasks);
+ $this->assertCount(1, $tasks);
+ $this->assertEquals('my task title is amazing', $tasks[0]['title']);
+
+
+
+ }
+
+
+
public function testCopy()
{
$tf = new TaskFilter($this->container);