summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-18 15:56:43 +0200
committerFrédéric Guillot <fred@kanboard.net>2014-09-18 15:56:43 +0200
commit7e6d35f829d63ce08f600d5d207b55244a16bdb3 (patch)
tree2017c3bcd60174989e01ed7e56b0a770b3aa69f2 /tests/units
parentc343a747431fa50cebdd7f622c8a0ddd262a9782 (diff)
Fix bug: overdue tasks email notification
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/TaskTest.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/units/TaskTest.php b/tests/units/TaskTest.php
index 98553428..ad9f4cb8 100644
--- a/tests/units/TaskTest.php
+++ b/tests/units/TaskTest.php
@@ -24,6 +24,7 @@ class TaskTest extends Base
$this->assertEquals('yellow', $task['color_id']);
$this->assertEquals(time(), $task['date_creation']);
$this->assertEquals(time(), $task['date_modification']);
+ $this->assertEquals(0, $task['date_due']);
$this->assertEquals(2, $t->create(array('title' => 'Task #2', 'project_id' => 1)));
@@ -33,6 +34,7 @@ class TaskTest extends Base
$this->assertEquals(2, $task['position']);
$this->assertEquals(time(), $task['date_creation']);
$this->assertEquals(time(), $task['date_modification']);
+ $this->assertEquals(0, $task['date_due']);
$tasks = $t->getAll(1, 1);
$this->assertNotEmpty($tasks);
@@ -56,6 +58,24 @@ class TaskTest extends Base
$this->assertFalse($t->remove(1234));
}
+ public function testGetOverdueTasks()
+ {
+ $t = new Task($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 = $t->getOverdueTasks();
+ $this->assertNotEmpty($tasks);
+ $this->assertTrue(is_array($tasks));
+ $this->assertEquals(1, count($tasks));
+ $this->assertEquals('Task #1', $tasks[0]['title']);
+ }
+
public function testMoveTaskWithColumnThatNotChange()
{
$t = new Task($this->registry);