diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-07-18 11:42:54 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-07-18 11:42:54 -0400 |
commit | 3260dfb0492ed9f18268ba0773b8ad9bee8dc747 (patch) | |
tree | 01fb8f8af51c7c0b56dda82238041eee13f03e17 /tests/units | |
parent | dfd79722270b4f7a6653cb130b6518dcd7bd8c95 (diff) | |
parent | 0f2d57ca5b00fb58e5b3baadb64fcd011c666ff6 (diff) |
Merge pull-request #1012
Diffstat (limited to 'tests/units')
-rw-r--r-- | tests/units/TaskFilterTest.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/units/TaskFilterTest.php b/tests/units/TaskFilterTest.php index 58d02524..cf65198c 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; use Model\Config; use Model\Swimlane; @@ -528,6 +529,35 @@ 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' => 'Paul 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); |