summaryrefslogtreecommitdiff
path: root/tests/units/Filter
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-10-09 20:35:30 -0400
committerFrederic Guillot <fred@kanboard.net>2016-10-09 20:35:30 -0400
commit71ad04cd66531aa29d8859d7115ec47acf8b89c3 (patch)
tree0ca55c12af017e16921c3a52dea6364395552ecf /tests/units/Filter
parentd7e92cf290f4694e16fea67caa1970ddd5fcb0c4 (diff)
Add filter tag:none
Diffstat (limited to 'tests/units/Filter')
-rw-r--r--tests/units/Filter/TaskTagFilterTest.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/units/Filter/TaskTagFilterTest.php b/tests/units/Filter/TaskTagFilterTest.php
index 72ed9904..2e235222 100644
--- a/tests/units/Filter/TaskTagFilterTest.php
+++ b/tests/units/Filter/TaskTagFilterTest.php
@@ -119,4 +119,31 @@ class TaskTagFilterTest extends Base
$this->assertEquals('test1', $tasks[0]['title']);
$this->assertEquals('test2', $tasks[1]['title']);
}
+
+ public function testWithNone()
+ {
+ $taskFinderModel = new TaskFinderModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskTagModel = new TaskTagModel($this->container);
+ $query = $taskFinderModel->getExtendedQuery();
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test1')));
+ $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test2')));
+ $this->assertEquals(3, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test3')));
+
+ $this->assertTrue($taskTagModel->save(1, 1, array('My tag 1', 'My tag 2', 'My tag 3')));
+ $this->assertTrue($taskTagModel->save(1, 2, array('My tag 3')));
+
+ $filter = new TaskTagFilter();
+ $filter->setDatabase($this->container['db']);
+ $filter->withQuery($query);
+ $filter->withValue('none');
+ $filter->apply();
+
+ $tasks = $query->findAll();
+ $this->assertCount(1, $tasks);
+ $this->assertEquals('test3', $tasks[0]['title']);
+ }
}