summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-23 15:55:59 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-23 15:55:59 -0500
commitf684602ebedc0adc4a329693ba524ad46d5cd8b0 (patch)
tree55a46e900f953a6b437ab20d245aa519dacd40d7
parent35e4c1daaa6ede7006905e3e39a751eafd544496 (diff)
Create TaskModification model
-rw-r--r--app/Action/Base.php1
-rw-r--r--app/Action/TaskAssignCategoryColor.php2
-rw-r--r--app/Action/TaskAssignCategoryLabel.php2
-rw-r--r--app/Action/TaskAssignColorCategory.php2
-rw-r--r--app/Action/TaskAssignColorUser.php2
-rw-r--r--app/Action/TaskAssignCurrentUser.php2
-rw-r--r--app/Action/TaskAssignSpecificUser.php2
-rw-r--r--app/Action/TaskAssignUser.php2
-rw-r--r--app/Controller/Base.php1
-rw-r--r--app/Controller/Board.php4
-rw-r--r--app/Controller/Task.php6
-rw-r--r--app/Model/Task.php83
-rw-r--r--app/Model/TaskModification.php73
-rw-r--r--app/Model/TaskPosition.php8
-rw-r--r--jsonrpc.php5
-rw-r--r--tests/units/TaskModificationTest.php225
-rw-r--r--tests/units/TaskTest.php23
-rw-r--r--tests/units/TimeTrackingTest.php6
18 files changed, 326 insertions, 123 deletions
diff --git a/app/Action/Base.php b/app/Action/Base.php
index c8c589c1..b7255371 100644
--- a/app/Action/Base.php
+++ b/app/Action/Base.php
@@ -16,6 +16,7 @@ use Core\Tool;
* @property \Model\Comment $comment
* @property \Model\Task $task
* @property \Model\TaskCreation $taskCreation
+ * @property \Model\TaskModification $taskModification
* @property \Model\TaskFinder $taskFinder
* @property \Model\TaskStatus $taskStatus
*/
diff --git a/app/Action/TaskAssignCategoryColor.php b/app/Action/TaskAssignCategoryColor.php
index be15f659..4134b584 100644
--- a/app/Action/TaskAssignCategoryColor.php
+++ b/app/Action/TaskAssignCategoryColor.php
@@ -67,7 +67,7 @@ class TaskAssignCategoryColor extends Base
'category_id' => $this->getParam('category_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values, false);
}
/**
diff --git a/app/Action/TaskAssignCategoryLabel.php b/app/Action/TaskAssignCategoryLabel.php
index 5e1b025e..da41a313 100644
--- a/app/Action/TaskAssignCategoryLabel.php
+++ b/app/Action/TaskAssignCategoryLabel.php
@@ -67,7 +67,7 @@ class TaskAssignCategoryLabel extends Base
'category_id' => isset($data['category_id']) ? $data['category_id'] : $this->getParam('category_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values, false);
}
/**
diff --git a/app/Action/TaskAssignColorCategory.php b/app/Action/TaskAssignColorCategory.php
index f5a9ac5a..68bca5d0 100644
--- a/app/Action/TaskAssignColorCategory.php
+++ b/app/Action/TaskAssignColorCategory.php
@@ -67,7 +67,7 @@ class TaskAssignColorCategory extends Base
'color_id' => $this->getParam('color_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values, false);
}
/**
diff --git a/app/Action/TaskAssignColorUser.php b/app/Action/TaskAssignColorUser.php
index 00680186..d419ab4d 100644
--- a/app/Action/TaskAssignColorUser.php
+++ b/app/Action/TaskAssignColorUser.php
@@ -68,7 +68,7 @@ class TaskAssignColorUser extends Base
'color_id' => $this->getParam('color_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values, false);
}
/**
diff --git a/app/Action/TaskAssignCurrentUser.php b/app/Action/TaskAssignCurrentUser.php
index 7a9cf70b..9317bf83 100644
--- a/app/Action/TaskAssignCurrentUser.php
+++ b/app/Action/TaskAssignCurrentUser.php
@@ -67,7 +67,7 @@ class TaskAssignCurrentUser extends Base
'owner_id' => $this->acl->getUserId(),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values, false);
}
/**
diff --git a/app/Action/TaskAssignSpecificUser.php b/app/Action/TaskAssignSpecificUser.php
index f70459be..c3b979c2 100644
--- a/app/Action/TaskAssignSpecificUser.php
+++ b/app/Action/TaskAssignSpecificUser.php
@@ -68,7 +68,7 @@ class TaskAssignSpecificUser extends Base
'owner_id' => $this->getParam('user_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values, false);
}
/**
diff --git a/app/Action/TaskAssignUser.php b/app/Action/TaskAssignUser.php
index 29ea91e6..d01c4073 100644
--- a/app/Action/TaskAssignUser.php
+++ b/app/Action/TaskAssignUser.php
@@ -64,7 +64,7 @@ class TaskAssignUser extends Base
'owner_id' => $data['owner_id'],
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values, false);
}
/**
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index e317a56b..8dd96c56 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -34,6 +34,7 @@ use Model\LastLogin;
* @property \Model\SubTask $subTask
* @property \Model\Task $task
* @property \Model\TaskCreation $taskCreation
+ * @property \Model\TaskModification $taskModification
* @property \Model\TaskHistory $taskHistory
* @property \Model\TaskExport $taskExport
* @property \Model\TaskFinder $taskFinder
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index e14b94c7..bdc82136 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -62,7 +62,7 @@ class Board extends Base
list($valid,) = $this->taskValidator->validateAssigneeModification($values);
- if ($valid && $this->task->update($values)) {
+ if ($valid && $this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
}
else {
@@ -101,7 +101,7 @@ class Board extends Base
list($valid,) = $this->taskValidator->validateCategoryModification($values);
- if ($valid && $this->task->update($values)) {
+ if ($valid && $this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
}
else {
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index e75058d9..6c6eaf90 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -204,7 +204,7 @@ class Task extends Base
if ($valid) {
- if ($this->task->update($values)) {
+ if ($this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
if ($this->request->getIntegerParam('ajax')) {
@@ -245,7 +245,7 @@ class Task extends Base
list($valid, $errors) = $this->taskValidator->validateTimeModification($values);
- if ($valid && $this->task->update($values)) {
+ if ($valid && $this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
}
else {
@@ -386,7 +386,7 @@ class Task extends Base
if ($valid) {
- if ($this->task->update($values)) {
+ if ($this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
}
else {
diff --git a/app/Model/Task.php b/app/Model/Task.php
index 4fed25f6..f382b604 100644
--- a/app/Model/Task.php
+++ b/app/Model/Task.php
@@ -40,89 +40,6 @@ class Task extends Base
const EVENT_ASSIGNEE_CHANGE = 'task.assignee_change';
/**
- * Prepare data before task creation or modification
- *
- * @access public
- * @param array $values Form values
- */
- public function prepare(array &$values)
- {
- $this->dateParser->convert($values, array('date_due', 'date_started'));
- $this->removeFields($values, array('another_task', 'id'));
- $this->resetFields($values, array('date_due', 'date_started', 'score', 'category_id', 'time_estimated', 'time_spent'));
- $this->convertIntegerFields($values, array('is_active'));
- }
-
- /**
- * Prepare data before task modification
- *
- * @access public
- * @param array $values Form values
- */
- public function prepareModification(array &$values)
- {
- $this->prepare($values);
- $values['date_modification'] = time();
- }
-
- /**
- * Update a task
- *
- * @access public
- * @param array $values Form values
- * @param boolean $trigger_Events Trigger events
- * @return boolean
- */
- public function update(array $values, $trigger_events = true)
- {
- // Fetch original task
- $original_task = $this->taskFinder->getById($values['id']);
-
- if (! $original_task) {
- return false;
- }
-
- // Prepare data
- $updated_task = $values;
- $this->prepareModification($updated_task);
-
- $result = $this->db->table(self::TABLE)->eq('id', $values['id'])->update($updated_task);
-
- if ($result && $trigger_events) {
- $this->triggerUpdateEvents($original_task, $updated_task);
- }
-
- return true;
- }
-
- /**
- * Trigger events for task modification
- *
- * @access public
- * @param array $original_task Original task data
- * @param array $updated_task Updated task data
- */
- public function triggerUpdateEvents(array $original_task, array $updated_task)
- {
- $events = array();
-
- if (isset($updated_task['owner_id']) && $original_task['owner_id'] != $updated_task['owner_id']) {
- $events[] = self::EVENT_ASSIGNEE_CHANGE;
- }
- else {
- $events[] = self::EVENT_CREATE_UPDATE;
- $events[] = self::EVENT_UPDATE;
- }
-
- $event_data = array_merge($original_task, $updated_task);
- $event_data['task_id'] = $original_task['id'];
-
- foreach ($events as $event) {
- $this->event->trigger($event, $event_data);
- }
- }
-
- /**
* Remove a task
*
* @access public
diff --git a/app/Model/TaskModification.php b/app/Model/TaskModification.php
new file mode 100644
index 00000000..b165ea24
--- /dev/null
+++ b/app/Model/TaskModification.php
@@ -0,0 +1,73 @@
+<?php
+
+namespace Model;
+
+/**
+ * Task Modification
+ *
+ * @package model
+ * @author Frederic Guillot
+ */
+class TaskModification extends Base
+{
+ /**
+ * Update a task
+ *
+ * @access public
+ * @param array $values
+ * @param boolean $fire_events
+ * @return boolean
+ */
+ public function update(array $values, $fire_events = true)
+ {
+ $original_task = $this->taskFinder->getById($values['id']);
+
+ $this->prepare($values);
+ $result = $this->db->table(Task::TABLE)->eq('id', $original_task['id'])->update($values);
+
+ if ($result && $fire_events) {
+ $this->fireEvents($original_task, $values);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Fire events
+ *
+ * @access public
+ * @param array $task
+ * @param array $new_values
+ */
+ public function fireEvents(array $task, array $new_values)
+ {
+ $event_data = array_merge($task, $new_values, array('task_id' => $task['id']));
+
+ if (isset($new_values['owner_id']) && $task['owner_id'] != $new_values['owner_id']) {
+ $events = array(Task::EVENT_ASSIGNEE_CHANGE);
+ }
+ else {
+ $events = array(Task::EVENT_CREATE_UPDATE, Task::EVENT_UPDATE);
+ }
+
+ foreach ($events as $event) {
+ $this->event->trigger($event, $event_data);
+ }
+ }
+
+ /**
+ * Prepare data before task modification
+ *
+ * @access public
+ * @param array $values Form values
+ */
+ public function prepare(array &$values)
+ {
+ $this->dateParser->convert($values, array('date_due', 'date_started'));
+ $this->removeFields($values, array('another_task', 'id'));
+ $this->resetFields($values, array('date_due', 'date_started', 'score', 'category_id', 'time_estimated', 'time_spent'));
+ $this->convertIntegerFields($values, array('is_active'));
+
+ $values['date_modification'] = time();
+ }
+}
diff --git a/app/Model/TaskPosition.php b/app/Model/TaskPosition.php
index f8ac4fd9..c23bc3b5 100644
--- a/app/Model/TaskPosition.php
+++ b/app/Model/TaskPosition.php
@@ -109,6 +109,14 @@ class TaskPosition extends Base
});
}
+ /**
+ * Fire events
+ *
+ * @access public
+ * @param array $task
+ * @param integer $new_column_id
+ * @param integer $new_position
+ */
public function fireEvents(array $task, $new_column_id, $new_position)
{
$event_data = array(
diff --git a/jsonrpc.php b/jsonrpc.php
index 37604011..8890bea0 100644
--- a/jsonrpc.php
+++ b/jsonrpc.php
@@ -8,6 +8,7 @@ $models = array(
'ProjectPermission',
'Task',
'TaskCreation',
+ 'TaskModification',
'TaskFinder',
'TaskPosition',
'TaskStatus',
@@ -136,7 +137,7 @@ $server->register('createTask', function($title, $project_id, $color_id = '', $c
return $taskCreationModel->create($values);
});
-$server->register('updateTask', function($id, $title = null, $project_id = null, $color_id = null, $column_id = null, $owner_id = null, $creator_id = null, $date_due = null, $description = null, $category_id = null, $score = null) use ($taskModel, $taskValidatorModel) {
+$server->register('updateTask', function($id, $title = null, $project_id = null, $color_id = null, $column_id = null, $owner_id = null, $creator_id = null, $date_due = null, $description = null, $category_id = null, $score = null) use ($taskModificationModel, $taskValidatorModel) {
$values = array(
'id' => $id,
@@ -159,7 +160,7 @@ $server->register('updateTask', function($id, $title = null, $project_id = null,
}
list($valid) = $taskValidatorModel->validateApiModification($values);
- return $valid && $taskModel->update($values);
+ return $valid && $taskModificationModel->update($values);
});
diff --git a/tests/units/TaskModificationTest.php b/tests/units/TaskModificationTest.php
new file mode 100644
index 00000000..9217c582
--- /dev/null
+++ b/tests/units/TaskModificationTest.php
@@ -0,0 +1,225 @@
+<?php
+
+require_once __DIR__.'/Base.php';
+
+use Model\Task;
+use Model\TaskCreation;
+use Model\TaskModification;
+use Model\TaskFinder;
+use Model\TaskStatus;
+use Model\Project;
+use Model\ProjectPermission;
+
+class TaskModificationTest extends Base
+{
+ public function testChangeTitle()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+ $this->assertTrue($tm->update(array('id' => 1, 'title' => 'Task #1')));
+
+ $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_CREATE_UPDATE));
+ $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_UPDATE));
+
+ $event_data = $this->container['event']->getEventData(Task::EVENT_UPDATE);
+ $this->assertNotEmpty($event_data);
+ $this->assertEquals(1, $event_data['task_id']);
+ $this->assertEquals('Task #1', $event_data['title']);
+
+ $task = $tf->getById(1);
+ $this->assertEquals('Task #1', $task['title']);
+ }
+
+ public function testChangeAssignee()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(0, $task['owner_id']);
+
+ $this->assertTrue($tm->update(array('id' => 1, 'owner_id' => 1)));
+
+ $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_ASSIGNEE_CHANGE));
+
+ $event_data = $this->container['event']->getEventData(Task::EVENT_ASSIGNEE_CHANGE);
+ $this->assertNotEmpty($event_data);
+ $this->assertEquals(1, $event_data['task_id']);
+ $this->assertEquals(1, $event_data['owner_id']);
+
+ $task = $tf->getById(1);
+ $this->assertEquals(1, $task['owner_id']);
+ }
+
+ public function testChangeDescription()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals('', $task['description']);
+
+ $this->assertTrue($tm->update(array('id' => 1, 'description' => 'test')));
+
+ $task = $tf->getById(1);
+ $this->assertEquals('test', $task['description']);
+ }
+
+ public function testChangeCategory()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(0, $task['category_id']);
+
+ $this->assertTrue($tm->update(array('id' => 1, 'category_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(1, $task['category_id']);
+ }
+
+ public function testChangeColor()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals('yellow', $task['color_id']);
+
+ $this->assertTrue($tm->update(array('id' => 1, 'color_id' => 'blue')));
+
+ $task = $tf->getById(1);
+ $this->assertEquals('blue', $task['color_id']);
+ }
+
+ public function testChangeScore()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(0, $task['score']);
+
+ $this->assertTrue($tm->update(array('id' => 1, 'score' => 13)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(13, $task['score']);
+ }
+
+ public function testChangeDueDate()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(0, $task['date_due']);
+
+ $this->assertTrue($tm->update(array('id' => 1, 'date_due' => '2014-11-24')));
+
+ $task = $tf->getById(1);
+ $this->assertEquals('2014-11-24', date('Y-m-d', $task['date_due']));
+
+ $this->assertTrue($tm->update(array('id' => 1, 'date_due' => time())));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(date('Y-m-d'), date('Y-m-d', $task['date_due']));
+ }
+
+ public function testChangeStartedDate()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(0, $task['date_started']);
+
+ $this->assertTrue($tm->update(array('id' => 1, 'date_started' => '2014-11-24')));
+
+ $task = $tf->getById(1);
+ $this->assertEquals('2014-11-24', date('Y-m-d', $task['date_started']));
+
+ $this->assertTrue($tm->update(array('id' => 1, 'date_started' => time())));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(date('Y-m-d'), date('Y-m-d', $task['date_started']));
+ }
+
+ public function testChangeTimeEstimated()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(0, $task['time_estimated']);
+
+ $this->assertTrue($tm->update(array('id' => 1, 'time_estimated' => 13.3)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(13.3, $task['time_estimated']);
+ }
+
+ public function testChangeTimeSpent()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tm = new TaskModification($this->container);
+ $tf = new TaskFinder($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(0, $task['time_spent']);
+
+ $this->assertTrue($tm->update(array('id' => 1, 'time_spent' => 13.3)));
+
+ $task = $tf->getById(1);
+ $this->assertEquals(13.3, $task['time_spent']);
+ }
+}
diff --git a/tests/units/TaskTest.php b/tests/units/TaskTest.php
index 19c37591..e303856a 100644
--- a/tests/units/TaskTest.php
+++ b/tests/units/TaskTest.php
@@ -146,27 +146,4 @@ class TaskTest extends Base
$this->assertNotEmpty($task);
$this->assertEquals(0, $task['owner_id']);
}
-
- public function testEvents()
- {
- $t = new Task($this->container);
- $tc = new TaskCreation($this->container);
- $ts = new TaskStatus($this->container);
- $p = new Project($this->container);
-
- // We create a project
- $this->assertEquals(1, $p->create(array('name' => 'test')));
-
- // We create task
- $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1)));
-
- // We update a task
- $this->assertTrue($t->update(array('title' => 'test2', 'id' => 1)));
- $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_UPDATE));
- $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_CREATE_UPDATE));
-
- // We change the assignee
- $this->assertTrue($t->update(array('owner_id' => 1, 'id' => 1)));
- $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_ASSIGNEE_CHANGE));
- }
}
diff --git a/tests/units/TimeTrackingTest.php b/tests/units/TimeTrackingTest.php
index b7790b51..6cf28eee 100644
--- a/tests/units/TimeTrackingTest.php
+++ b/tests/units/TimeTrackingTest.php
@@ -3,7 +3,7 @@
require_once __DIR__.'/Base.php';
use Model\SubTask;
-use Model\Task;
+use Model\TaskModification;
use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
@@ -13,7 +13,7 @@ class TimeTrackingTest extends Base
{
public function testCalculateTime()
{
- $t = new Task($this->container);
+ $tm = new TaskModification($this->container);
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
$p = new Project($this->container);
@@ -22,7 +22,7 @@ class TimeTrackingTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'Project #1')));
$this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'time_estimated' => 4.5)));
- $this->assertTrue($t->update(array('id' => 1, 'time_spent' => 3.5)));
+ $this->assertTrue($tm->update(array('id' => 1, 'time_spent' => 3.5)));
$task = $tf->getById(1);
$this->assertNotEmpty($task);