From 4061927d215c846ff8eb196301bf61532018042b Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 12 Oct 2014 15:32:35 -0400 Subject: Move some Task model methods to the TaskFinder class --- tests/units/TaskFinderTest.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/units/TaskFinderTest.php (limited to 'tests/units/TaskFinderTest.php') diff --git a/tests/units/TaskFinderTest.php b/tests/units/TaskFinderTest.php new file mode 100644 index 00000000..5a90f3af --- /dev/null +++ b/tests/units/TaskFinderTest.php @@ -0,0 +1,32 @@ +registry); + $tf = new TaskFinder($this->registry); + $p = new Project($this->registry); + + $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); + $this->assertEquals(1, $t->create(array('title' => 'Task #1', 'project_id' => 1, 'date_due' => strtotime('-1 day')))); + $this->assertEquals(2, $t->create(array('title' => 'Task #2', 'project_id' => 1, 'date_due' => strtotime('+1 day')))); + $this->assertEquals(3, $t->create(array('title' => 'Task #3', 'project_id' => 1, 'date_due' => 0))); + $this->assertEquals(4, $t->create(array('title' => 'Task #3', 'project_id' => 1))); + + $tasks = $tf->getOverdueTasks(); + $this->assertNotEmpty($tasks); + $this->assertTrue(is_array($tasks)); + $this->assertEquals(1, count($tasks)); + $this->assertEquals('Task #1', $tasks[0]['title']); + } +} -- cgit v1.2.3