summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-10-12 14:28:08 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-10-12 14:28:08 -0400
commitb7060b33ef317eeac576c504b1fb840d4471e411 (patch)
tree8acf657eda4df76285905fc5e774aacecb02f488 /tests/units
parentdeeebd8e72a13fcbe6d357aefed9130671ee5161 (diff)
Add pagination/column sorting for search and completed tasks
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/TaskTest.php71
1 files changed, 1 insertions, 70 deletions
diff --git a/tests/units/TaskTest.php b/tests/units/TaskTest.php
index e01ed8be..4d121fcd 100644
--- a/tests/units/TaskTest.php
+++ b/tests/units/TaskTest.php
@@ -493,75 +493,6 @@ class TaskTest extends Base
$this->assertEquals($task_per_column + 1, $t->countByColumnId(1, 4));
}
- public function testFilter()
- {
- $t = new Task($this->registry);
- $p = new Project($this->registry);
-
- $this->assertEquals(1, $p->create(array('name' => 'test1')));
- $this->assertEquals(1, $t->create(array('title' => 'test a', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1, 'description' => 'biloute')));
- $this->assertEquals(2, $t->create(array('title' => 'test b', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 2, 'description' => 'toto et titi sont dans un bateau')));
-
- $tasks = $t->find(array(array('column' => 'project_id', 'operator' => 'eq', 'value' => '1')));
- $this->assertNotFalse($tasks);
- $this->assertEquals(2, count($tasks));
- $this->assertEquals(1, $tasks[0]['id']);
- $this->assertEquals(2, $tasks[1]['id']);
-
- $tasks = $t->find(array(
- array('column' => 'project_id', 'operator' => 'eq', 'value' => '1'),
- array('column' => 'owner_id', 'operator' => 'eq', 'value' => '2'),
- ));
- $this->assertEquals(1, count($tasks));
- $this->assertEquals(2, $tasks[0]['id']);
-
- $tasks = $t->find(array(
- array('column' => 'project_id', 'operator' => 'eq', 'value' => '1'),
- array('column' => 'title', 'operator' => 'like', 'value' => '%b%'),
- ));
- $this->assertEquals(1, count($tasks));
- $this->assertEquals(2, $tasks[0]['id']);
-
- // Condition with OR
- $search = 'bateau';
- $filters = array(
- array('column' => 'project_id', 'operator' => 'eq', 'value' => 1),
- 'or' => array(
- array('column' => 'title', 'operator' => 'like', 'value' => '%'.$search.'%'),
- array('column' => 'description', 'operator' => 'like', 'value' => '%'.$search.'%'),
- )
- );
-
- $tasks = $t->find($filters);
- $this->assertEquals(1, count($tasks));
- $this->assertEquals(2, $tasks[0]['id']);
-
- $search = 'toto et titi';
- $filters = array(
- array('column' => 'project_id', 'operator' => 'eq', 'value' => 1),
- 'or' => array(
- array('column' => 'title', 'operator' => 'like', 'value' => '%'.$search.'%'),
- array('column' => 'description', 'operator' => 'like', 'value' => '%'.$search.'%'),
- )
- );
-
- $tasks = $t->find($filters);
- $this->assertEquals(1, count($tasks));
- $this->assertEquals(2, $tasks[0]['id']);
-
- $search = 'john';
- $filters = array(
- array('column' => 'project_id', 'operator' => 'eq', 'value' => 1),
- 'or' => array(
- array('column' => 'title', 'operator' => 'like', 'value' => '%'.$search.'%'),
- array('column' => 'description', 'operator' => 'like', 'value' => '%'.$search.'%'),
- )
- );
-
- $tasks = $t->find($filters);
- $this->assertEquals(0, count($tasks));
- }
-
public function testDuplicateToTheSameProject()
{
$t = new Task($this->registry);
@@ -584,7 +515,7 @@ class TaskTest extends Base
$this->assertEquals(1, $task['position']);
// We duplicate our task
- $this->assertEquals(2, $t->duplicateSameProject($task));
+ $this->assertEquals(2, $t->duplicateToSameProject($task));
$this->assertTrue($this->registry->shared('event')->isEventTriggered(Task::EVENT_CREATE));
// Check the values of the duplicated task