Automatically update the start date when a task move away from a column
This commit is contained in:
parent
91d703eb8d
commit
d3d5522432
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
namespace Kanboard\Action;
|
||||
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
/**
|
||||
* Set the start date when task move away from certain column
|
||||
*
|
||||
* @package Kanboard\Action
|
||||
*/
|
||||
class TaskUpdateStartDateOnMoveColumn extends Base
|
||||
{
|
||||
/**
|
||||
* Get automatic action description
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return t('Automatically update the start date when task move away from certain column');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of compatible events
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getCompatibleEvents()
|
||||
{
|
||||
return array(
|
||||
TaskModel::EVENT_MOVE_COLUMN,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the required parameter for the action (defined by the user)
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getActionRequiredParameters()
|
||||
{
|
||||
return array(
|
||||
'column_id' => t('Column'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the required parameter for the event
|
||||
*
|
||||
* @access public
|
||||
* @return string[]
|
||||
*/
|
||||
public function getEventRequiredParameters()
|
||||
{
|
||||
return array(
|
||||
'task_id',
|
||||
'task' => array(
|
||||
'project_id',
|
||||
'column_id',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the action (set the task date_started)
|
||||
*
|
||||
* @access public
|
||||
* @param array $data Event data dictionary
|
||||
* @return bool True if the action was executed or false when not executed
|
||||
*/
|
||||
public function doAction(array $data)
|
||||
{
|
||||
$values = array(
|
||||
'id' => $data['task_id'],
|
||||
'date_started' => time(),
|
||||
);
|
||||
|
||||
return $this->taskModificationModel->update($values, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the event data meet the action condition
|
||||
*
|
||||
* @access public
|
||||
* @param array $data Event data dictionary
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRequiredCondition(array $data)
|
||||
{
|
||||
return empty($data['task']['date_started']) && $data['task']['column_id'] != $this->getParam('column_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
'%s moved the task #%d "%s" to the project "%s"' => '%s flyttede opgave #%d "%s" til projekt "%s"',
|
||||
'Task #%d "%s" has been moved to the project "%s"' => 'Opgave #%d "%s" er flyttet til projekt "%s"',
|
||||
'Move the task to another column when the due date is less than a certain number of days' => 'Flytte opgave til anden kolonne når afleveringsdato er mindre end et bestemt antal dage',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
'HTTP Client:' => 'HTTP klient:',
|
||||
'XBT - bitcoin' => 'XBT - bitcoin',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
'%s moved the task #%d "%s" to the project "%s"' => '%s a déplacé la tâche #%d « %s » vers le projet « %s »',
|
||||
'Task #%d "%s" has been moved to the project "%s"' => 'La tâche #%d « %s » a été déplacée vers le projet « %s »',
|
||||
'Move the task to another column when the due date is less than a certain number of days' => 'Déplaçer la tâche dans une autre colonne lorsque la date d\'échéance est inférieure à un certain nombre de jour',
|
||||
'Automatically update the start date when task move away from certain column' => 'Mettre à jour automatiquement la date de début lorsque la tâche change de colonne',
|
||||
'HTTP Client:' => 'Client HTTP :',
|
||||
'XBT - bitcoin' => 'XBT - Bitcoin',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
'%s moved the task #%d "%s" to the project "%s"' => '%s がタスク #%d "%s" をプロジェクト "%s" に移動しました',
|
||||
'Task #%d "%s" has been moved to the project "%s"' => 'タスク#%d "%s" はプロジェクト "%s" へ移動されました ',
|
||||
'Move the task to another column when the due date is less than a certain number of days' => '期限までの日数が規定値以下になったら、タスクを別のカラムに移動する',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
'HTTP Client:' => 'HTTPクライアント',
|
||||
'XBT - bitcoin' => 'XBT - bitcoin',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
'%s moved the task #%d "%s" to the project "%s"' => '%s moveu a tarefa #%d "%s" para o projeto "%s"',
|
||||
'Task #%d "%s" has been moved to the project "%s"' => 'Tarefa #%d "%s" foi movida para o projeto "%s"',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1398,11 +1398,12 @@ return array(
|
|||
'Reorder this column by assignee and priority (DESC)' => '按指派和优先级倒序重排',
|
||||
'Reorder this column by assignee (A-Z)' => '按指派重排(A-Z)',
|
||||
'Reorder this column by assignee (Z-A)' => '按指派倒序重排(Z-A)',
|
||||
// 'Reorder this column by due date (ASC)' => '',
|
||||
// 'Reorder this column by due date (DESC)' => '',
|
||||
'Reorder this column by due date (ASC)' => '按逾期时间顺序重排(ASC)',
|
||||
'Reorder this column by due date (DESC)' => '按逾期时间倒序重排(DESC)',
|
||||
'%s moved the task #%d "%s" to the project "%s"' => '%s 已将任务 #%d "%s" 移动到项目"%s" ',
|
||||
'Task #%d "%s" has been moved to the project "%s"' => '任务 #%d "%s" 已被移动到项目 "%s"',
|
||||
'Move the task to another column when the due date is less than a certain number of days' => '当任务即将在指定天数内超期时移动到另一栏',
|
||||
'Automatically update the start date when task move away from certain column' => '当任务离开指定栏目时自动开始计时',
|
||||
'HTTP Client:' => 'HTTP客户端',
|
||||
'XBT - bitcoin' => 'XBT - 比特币',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ return array(
|
|||
// '%s moved the task #%d "%s" to the project "%s"' => '',
|
||||
// 'Task #%d "%s" has been moved to the project "%s"' => '',
|
||||
// 'Move the task to another column when the due date is less than a certain number of days' => '',
|
||||
// 'Automatically update the start date when task move away from certain column' => '',
|
||||
// 'HTTP Client:' => '',
|
||||
// 'XBT - bitcoin' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ use Kanboard\Action\TaskMoveColumnUnAssigned;
|
|||
use Kanboard\Action\TaskMoveSwimlaneCategoryChange;
|
||||
use Kanboard\Action\TaskOpen;
|
||||
use Kanboard\Action\TaskUpdateStartDate;
|
||||
use Kanboard\Action\TaskUpdateStartDateOnMoveColumn;
|
||||
use Kanboard\Action\TaskCloseNoActivity;
|
||||
use Kanboard\Action\TaskCloseNoActivityColumn;
|
||||
use Kanboard\Action\TaskCloseNotMovedColumn;
|
||||
|
|
@ -104,6 +105,7 @@ class ActionProvider implements ServiceProviderInterface
|
|||
$container['actionManager']->register(new TaskMoveSwimlaneCategoryChange($container));
|
||||
$container['actionManager']->register(new TaskOpen($container));
|
||||
$container['actionManager']->register(new TaskUpdateStartDate($container));
|
||||
$container['actionManager']->register(new TaskUpdateStartDateOnMoveColumn($container));
|
||||
$container['actionManager']->register(new TaskAssignDueDateOnCreation($container));
|
||||
$container['actionManager']->register(new TaskAssignColorSwimlane($container));
|
||||
$container['actionManager']->register(new TaskAssignPrioritySwimlane($container));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\TaskEvent;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskUpdateStartDateOnMoveColumn;
|
||||
|
||||
class TaskUpdateStartDateOnMoveColumnTest extends Base
|
||||
{
|
||||
public function testChangeColumn()
|
||||
{
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 1)));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('column_id' => 2));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
|
||||
$event = new TaskEvent(array(
|
||||
'task_id' => $task['id'],
|
||||
'task' => array(
|
||||
'project_id' => $task['project_id'],
|
||||
'column_id' => $task['column_id'],
|
||||
)
|
||||
));
|
||||
|
||||
$action = new TaskUpdateStartDateOnMoveColumn($this->container);
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 1);
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertTrue($task['date_started'] > 0, 'task start date updated');
|
||||
}
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 2)));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('column_id' => 1));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
|
||||
$event = new TaskEvent(array(
|
||||
'task_id' => $task['id'],
|
||||
'task' => array(
|
||||
'project_id' => $task['project_id'],
|
||||
'column_id' => $task['column_id'],
|
||||
)
|
||||
));
|
||||
|
||||
$action = new TaskUpdateStartDateOnMoveColumn($this->container);
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 1);
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
}
|
||||
|
||||
public function testWithStarted()
|
||||
{
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 1, 'date_started' => time())));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('column_id' => 2));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
|
||||
$event = new TaskEvent(array(
|
||||
'task_id' => $task['id'],
|
||||
'task' => array(
|
||||
'project_id' => $task['project_id'],
|
||||
'column_id' => $task['column_id'],
|
||||
'date_started' => $task['date_started'],
|
||||
)
|
||||
));
|
||||
|
||||
$action = new TaskUpdateStartDateOnMoveColumn($this->container);
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 1);
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue