Add search attribute to search by reference
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user