summaryrefslogtreecommitdiff
path: root/tests/units/TaskFilterTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-04 17:35:52 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-04 17:35:52 -0400
commit198f3eda90807c0295a013cd4ebdc3806545d608 (patch)
tree07420711d703bf71f0b1596a891ec6957c71719b /tests/units/TaskFilterTest.php
parent0e5756ecc162a8428e6ab3820562f45ef17f9e8b (diff)
Add search attribute to search by reference
Diffstat (limited to 'tests/units/TaskFilterTest.php')
-rw-r--r--tests/units/TaskFilterTest.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/units/TaskFilterTest.php b/tests/units/TaskFilterTest.php
index c68e8880..6a48f194 100644
--- a/tests/units/TaskFilterTest.php
+++ b/tests/units/TaskFilterTest.php
@@ -27,6 +27,37 @@ class TaskFilterTest extends Base
$this->assertEmpty($tf->search('search something')->findAll());
}
+ public function testSearchWithReference()
+ {
+ $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' => 'task1')));
+ $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task2', 'reference' => 123)));
+
+ $tf->search('ref:123');
+ $tasks = $tf->findAll();
+ $this->assertNotEmpty($tasks);
+ $this->assertCount(1, $tasks);
+ $this->assertEquals('task2', $tasks[0]['title']);
+
+ $tf->search('reference:123');
+ $tasks = $tf->findAll();
+ $this->assertNotEmpty($tasks);
+ $this->assertCount(1, $tasks);
+ $this->assertEquals('task2', $tasks[0]['title']);
+
+ $tf->search('ref:plop');
+ $tasks = $tf->findAll();
+ $this->assertEmpty($tasks);
+
+ $tf->search('ref:');
+ $tasks = $tf->findAll();
+ $this->assertEmpty($tasks);
+ }
+
public function testSearchWithStatus()
{
$p = new Project($this->container);