summaryrefslogtreecommitdiff
path: root/tests/units/Model/TaskFinderTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-03 17:21:29 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-03 17:21:29 -0400
commit260c8515c507b8c339fdbe1a10b0f13792eac09d (patch)
tree39483e9918e1589786144af79b367492f04e2281 /tests/units/Model/TaskFinderTest.php
parentd7c0fabcb79fd72993cd00fe00d49bc5656bc204 (diff)
Add more unit tests
Diffstat (limited to 'tests/units/Model/TaskFinderTest.php')
-rw-r--r--tests/units/Model/TaskFinderTest.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/units/Model/TaskFinderTest.php b/tests/units/Model/TaskFinderTest.php
index 3601efdd..1d850ba7 100644
--- a/tests/units/Model/TaskFinderTest.php
+++ b/tests/units/Model/TaskFinderTest.php
@@ -27,7 +27,7 @@ class TaskFinderTest extends Base
$tasks = $tf->getOverdueTasks();
$this->assertNotEmpty($tasks);
$this->assertTrue(is_array($tasks));
- $this->assertEquals(1, count($tasks));
+ $this->assertCount(1, $tasks);
$this->assertEquals('Task #1', $tasks[0]['title']);
}
@@ -48,7 +48,7 @@ class TaskFinderTest extends Base
$tasks = $tf->getOverdueTasksByProject(1);
$this->assertNotEmpty($tasks);
$this->assertTrue(is_array($tasks));
- $this->assertEquals(1, count($tasks));
+ $this->assertcount(1, $tasks);
$this->assertEquals('Task #1', $tasks[0]['title']);
}
@@ -69,7 +69,7 @@ class TaskFinderTest extends Base
$tasks = $tf->getOverdueTasksByUser(1);
$this->assertNotEmpty($tasks);
$this->assertTrue(is_array($tasks));
- $this->assertEquals(2, count($tasks));
+ $this->assertCount(2, $tasks);
$this->assertEquals(1, $tasks[0]['id']);
$this->assertEquals('Task #1', $tasks[0]['title']);
@@ -81,4 +81,20 @@ class TaskFinderTest extends Base
$this->assertEquals('Task #2', $tasks[1]['title']);
}
+
+ public function testCountByProject()
+ {
+ $tc = new TaskCreation($this->container);
+ $tf = new TaskFinder($this->container);
+ $p = new Project($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
+ $this->assertEquals(2, $p->create(array('name' => 'Project #2')));
+ $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1)));
+ $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 2)));
+ $this->assertEquals(3, $tc->create(array('title' => 'Task #3', 'project_id' => 2)));
+
+ $this->assertEquals(1, $tf->countByProjectId(1));
+ $this->assertEquals(2, $tf->countByProjectId(2));
+ }
}