From 7c1222fc595091d9e292bae9d563a3fdaf660d7b Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 28 Jun 2015 21:04:37 -0400 Subject: Add description attribute for advanced search --- tests/units/TaskFilterTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/units/TaskFilterTest.php') diff --git a/tests/units/TaskFilterTest.php b/tests/units/TaskFilterTest.php index 4f826cd2..494a0f1b 100644 --- a/tests/units/TaskFilterTest.php +++ b/tests/units/TaskFilterTest.php @@ -53,6 +53,27 @@ class TaskFilterTest extends Base $this->assertCount(1, $tasks); } + public function testSearchWithDescription() + { + $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', 'description' => '**something to do**'))); + + $tf->search('description:"something"'); + $tasks = $tf->findAll(); + $this->assertNotEmpty($tasks); + $this->assertCount(1, $tasks); + $this->assertEquals('task2', $tasks[0]['title']); + + $tf->search('description:"rainy day"'); + $tasks = $tf->findAll(); + $this->assertEmpty($tasks); + } + public function testSearchWithDueDate() { $dp = new DateParser($this->container); -- cgit v1.2.3