summaryrefslogtreecommitdiff
path: root/tests/units/TaskFilterTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-28 20:47:39 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-28 20:47:39 -0400
commit2e7e7031804b09a04c83896535b31acb12138960 (patch)
treeafc617dc3679c464b7cb7e8ec6ff96c3bf1cdfb5 /tests/units/TaskFilterTest.php
parent7af5a923b047f612c02af2fe39a09beb45792f3a (diff)
Add status attribute for advanced search
Diffstat (limited to 'tests/units/TaskFilterTest.php')
-rw-r--r--tests/units/TaskFilterTest.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/units/TaskFilterTest.php b/tests/units/TaskFilterTest.php
index 4e2366e5..4f826cd2 100644
--- a/tests/units/TaskFilterTest.php
+++ b/tests/units/TaskFilterTest.php
@@ -26,6 +26,33 @@ class TaskFilterTest extends Base
$this->assertEmpty($tf->search('search something')->findAll());
}
+ public function testSearchWithStatus()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tf = new TaskFilter($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'my task title is awesome')));
+ $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'my task title is amazing')));
+ $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'my task title is amazing', 'is_active' => 0)));
+
+ $tf->search('status:open');
+ $tasks = $tf->findAll();
+ $this->assertNotEmpty($tasks);
+ $this->assertCount(2, $tasks);
+
+ $tf->search('status:plop');
+ $tasks = $tf->findAll();
+ $this->assertNotEmpty($tasks);
+ $this->assertCount(3, $tasks);
+
+ $tf->search('status:closed');
+ $tasks = $tf->findAll();
+ $this->assertNotEmpty($tasks);
+ $this->assertCount(1, $tasks);
+ }
+
public function testSearchWithDueDate()
{
$dp = new DateParser($this->container);