diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-07-18 11:33:51 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-07-18 11:33:51 -0400 |
commit | dfd79722270b4f7a6653cb130b6518dcd7bd8c95 (patch) | |
tree | 122a0c4ddfe0fcca6f87b100c51a8ce36bcbc78a /tests/units/TaskFilterTest.php | |
parent | d75a0a9d455c01b6845dcc2ea7d61d55d416766b (diff) |
Add new search attribute for swimlane
Diffstat (limited to 'tests/units/TaskFilterTest.php')
-rw-r--r-- | tests/units/TaskFilterTest.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/units/TaskFilterTest.php b/tests/units/TaskFilterTest.php index 14a9b1c0..58d02524 100644 --- a/tests/units/TaskFilterTest.php +++ b/tests/units/TaskFilterTest.php @@ -9,6 +9,7 @@ use Model\TaskCreation; use Model\DateParser; use Model\Category; use Model\Config; +use Model\Swimlane; class TaskFilterTest extends Base { @@ -286,6 +287,64 @@ class TaskFilterTest extends Base $this->assertEmpty($tasks); } + public function testSearchWithSwimlane() + { + $p = new Project($this->container); + $tc = new TaskCreation($this->container); + $tf = new TaskFilter($this->container); + $s = new Swimlane($this->container); + + $this->assertEquals(1, $p->create(array('name' => 'My project A'))); + $this->assertEquals(1, $s->create(1, 'Version 1.1')); + $this->assertEquals(2, $s->create(1, 'Version 1.2')); + $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task1', 'swimlane_id' => 1))); + $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task2', 'swimlane_id' => 2))); + $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task3', 'swimlane_id' => 0))); + + $tf->search('swimlane:"Version 1.1"'); + $tasks = $tf->findAll(); + $this->assertNotEmpty($tasks); + $this->assertCount(1, $tasks); + $this->assertEquals('task1', $tasks[0]['title']); + $this->assertEquals('Version 1.1', $tasks[0]['swimlane_name']); + + $tf->search('swimlane:"versioN 1.2"'); + $tasks = $tf->findAll(); + $this->assertNotEmpty($tasks); + $this->assertCount(1, $tasks); + $this->assertEquals('task2', $tasks[0]['title']); + $this->assertEquals('Version 1.2', $tasks[0]['swimlane_name']); + + $tf->search('swimlane:"Default swimlane"'); + $tasks = $tf->findAll(); + $this->assertNotEmpty($tasks); + $this->assertCount(1, $tasks); + $this->assertEquals('task3', $tasks[0]['title']); + $this->assertEquals('Default swimlane', $tasks[0]['default_swimlane']); + $this->assertEquals('', $tasks[0]['swimlane_name']); + + $tf->search('swimlane:default'); + $tasks = $tf->findAll(); + $this->assertNotEmpty($tasks); + $this->assertCount(1, $tasks); + $this->assertEquals('task3', $tasks[0]['title']); + $this->assertEquals('Default swimlane', $tasks[0]['default_swimlane']); + $this->assertEquals('', $tasks[0]['swimlane_name']); + + $tf->search('swimlane:"Version 1.1" swimlane:"Version 1.2"'); + $tasks = $tf->findAll(); + $this->assertNotEmpty($tasks); + $this->assertCount(2, $tasks); + $this->assertEquals('task1', $tasks[0]['title']); + $this->assertEquals('Version 1.1', $tasks[0]['swimlane_name']); + $this->assertEquals('task2', $tasks[1]['title']); + $this->assertEquals('Version 1.2', $tasks[1]['swimlane_name']); + + $tf->search('swimlane:"not found"'); + $tasks = $tf->findAll(); + $this->assertEmpty($tasks); + } + public function testSearchWithColumn() { $p = new Project($this->container); |