diff options
author | Rafael de Camargo <rafacamargo123@gmail.com> | 2019-08-25 01:50:22 -0300 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2019-08-27 20:28:58 -0700 |
commit | c6df7c081a05139d42d571bbfa74395fcbf3fa4c (patch) | |
tree | 5ddaa6b7e8d01c88d3c1d271a794aae08a2ed369 | |
parent | 1731211908f949e501b43262985e07f7cde785e2 (diff) |
Fixes task assignee filter test
The query must be reset before every filter apply
-rw-r--r-- | tests/units/Filter/TaskAssigneeFilterTest.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/units/Filter/TaskAssigneeFilterTest.php b/tests/units/Filter/TaskAssigneeFilterTest.php index dec3824e..9d63e20c 100644 --- a/tests/units/Filter/TaskAssigneeFilterTest.php +++ b/tests/units/Filter/TaskAssigneeFilterTest.php @@ -15,11 +15,11 @@ class TaskAssigneeFilterTest extends Base $taskFinder = new TaskFinderModel($this->container); $taskCreation = new TaskCreationModel($this->container); $projectModel = new ProjectModel($this->container); - $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1, 'owner_id' => 1))); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->withQuery($query); $filter->withValue(1); @@ -27,6 +27,7 @@ class TaskAssigneeFilterTest extends Base $this->assertCount(1, $query->findAll()); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->withQuery($query); $filter->withValue(123); @@ -40,11 +41,11 @@ class TaskAssigneeFilterTest extends Base $taskFinder = new TaskFinderModel($this->container); $taskCreation = new TaskCreationModel($this->container); $projectModel = new ProjectModel($this->container); - $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1, 'owner_id' => 1))); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->withQuery($query); $filter->withValue('1'); @@ -52,6 +53,7 @@ class TaskAssigneeFilterTest extends Base $this->assertCount(1, $query->findAll()); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->withQuery($query); $filter->withValue("123"); @@ -65,11 +67,11 @@ class TaskAssigneeFilterTest extends Base $taskFinder = new TaskFinderModel($this->container); $taskCreation = new TaskCreationModel($this->container); $projectModel = new ProjectModel($this->container); - $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1, 'owner_id' => 1))); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->withQuery($query); $filter->withValue('admin'); @@ -77,6 +79,7 @@ class TaskAssigneeFilterTest extends Base $this->assertCount(1, $query->findAll()); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->withQuery($query); $filter->withValue('foobar'); @@ -91,12 +94,12 @@ class TaskAssigneeFilterTest extends Base $taskCreation = new TaskCreationModel($this->container); $projectModel = new ProjectModel($this->container); $userModel = new UserModel($this->container); - $query = $taskFinder->getExtendedQuery(); $this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar'))); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1, 'owner_id' => 2))); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->withQuery($query); $filter->withValue('foo bar'); @@ -104,6 +107,7 @@ class TaskAssigneeFilterTest extends Base $this->assertCount(1, $query->findAll()); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->withQuery($query); $filter->withValue('bob'); @@ -117,11 +121,11 @@ class TaskAssigneeFilterTest extends Base $taskFinder = new TaskFinderModel($this->container); $taskCreation = new TaskCreationModel($this->container); $projectModel = new ProjectModel($this->container); - $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->withQuery($query); $filter->withValue('nobody'); @@ -135,11 +139,11 @@ class TaskAssigneeFilterTest extends Base $taskFinder = new TaskFinderModel($this->container); $taskCreation = new TaskCreationModel($this->container); $projectModel = new ProjectModel($this->container); - $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1, 'owner_id' => 1))); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->setCurrentUserId(1); $filter->withQuery($query); @@ -148,6 +152,7 @@ class TaskAssigneeFilterTest extends Base $this->assertCount(1, $query->findAll()); + $query = $taskFinder->getExtendedQuery(); $filter = new TaskAssigneeFilter(); $filter->setCurrentUserId(2); $filter->withQuery($query); |