diff options
29 files changed, 184 insertions, 32 deletions
@@ -3,6 +3,7 @@ Version 1.0.28 (unreleased) New features: +* Added automated action to change task color based on the priority * Added support for LDAP Posix Groups (OpenLDAP with memberUid) * Search in activity stream * Search in comments diff --git a/app/Action/TaskAssignColorPriority.php b/app/Action/TaskAssignColorPriority.php new file mode 100644 index 00000000..2e24f9ef --- /dev/null +++ b/app/Action/TaskAssignColorPriority.php @@ -0,0 +1,95 @@ +<?php + +namespace Kanboard\Action; + +use Kanboard\Model\Task; + +/** + * Assign a color to a priority + * + * @package action + * @author Frederic Guillot + */ +class TaskAssignColorPriority extends Base +{ + /** + * Get automatic action description + * + * @access public + * @return string + */ + public function getDescription() + { + return t('Assign automatically a color based on a priority'); + } + + /** + * Get the list of compatible events + * + * @access public + * @return array + */ + public function getCompatibleEvents() + { + return array( + Task::EVENT_CREATE_UPDATE, + ); + } + + /** + * Get the required parameter for the action (defined by the user) + * + * @access public + * @return array + */ + public function getActionRequiredParameters() + { + return array( + 'color_id' => t('Color'), + 'priority' => t('Priority'), + ); + } + + /** + * Get the required parameter for the event + * + * @access public + * @return string[] + */ + public function getEventRequiredParameters() + { + return array( + 'task_id', + 'priority', + ); + } + + /** + * Execute the action (change the task color) + * + * @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'], + 'color_id' => $this->getParam('color_id'), + ); + + return $this->taskModification->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 $data['priority'] == $this->getParam('priority'); + } +} diff --git a/app/Controller/ActionCreation.php b/app/Controller/ActionCreation.php index 24a12d92..61b7b5e2 100644 --- a/app/Controller/ActionCreation.php +++ b/app/Controller/ActionCreation.php @@ -81,6 +81,7 @@ class ActionCreation extends Base 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), 'links_list' => $this->link->getList(0, false), + 'priorities_list' => $this->project->getPriorities($project), 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), diff --git a/app/Model/Project.php b/app/Model/Project.php index 6e3c2326..9843a54c 100644 --- a/app/Model/Project.php +++ b/app/Model/Project.php @@ -201,7 +201,7 @@ class Project extends Base * Get all projects with all its data for a given status * * @access public - * @param integer $status Proejct status: self::ACTIVE or self:INACTIVE + * @param integer $status Project status: self::ACTIVE or self:INACTIVE * @return array */ public function getAllByStatus($status) @@ -245,6 +245,19 @@ class Project extends Base } /** + * Get Priority range from a project + * + * @access public + * @param array $project + * @return array + */ + public function getPriorities(array $project) + { + $range = range($project['priority_start'], $project['priority_end']); + return array_combine($range, $range); + } + + /** * Gather some task metrics for a given project * * @access public diff --git a/app/ServiceProvider/ActionProvider.php b/app/ServiceProvider/ActionProvider.php index 3692f190..7c92f3ce 100644 --- a/app/ServiceProvider/ActionProvider.php +++ b/app/ServiceProvider/ActionProvider.php @@ -2,6 +2,7 @@ namespace Kanboard\ServiceProvider; +use Kanboard\Action\TaskAssignColorPriority; use Pimple\Container; use Pimple\ServiceProviderInterface; use Kanboard\Core\Action\ActionManager; @@ -59,6 +60,7 @@ class ActionProvider implements ServiceProviderInterface $container['actionManager']->register(new TaskAssignColorColumn($container)); $container['actionManager']->register(new TaskAssignColorLink($container)); $container['actionManager']->register(new TaskAssignColorUser($container)); + $container['actionManager']->register(new TaskAssignColorPriority($container)); $container['actionManager']->register(new TaskAssignCurrentUser($container)); $container['actionManager']->register(new TaskAssignCurrentUserColumn($container)); $container['actionManager']->register(new TaskAssignSpecificUser($container)); diff --git a/app/Template/action_creation/params.php b/app/Template/action_creation/params.php index 59ff6ce9..46ca52a4 100644 --- a/app/Template/action_creation/params.php +++ b/app/Template/action_creation/params.php @@ -35,6 +35,9 @@ <?php elseif ($this->text->contains($param_name, 'link_id')): ?> <?= $this->form->label($param_desc, $param_name) ?> <?= $this->form->select('params['.$param_name.']', $links_list, $values) ?> + <?php elseif ($param_name === 'priority'): ?> + <?= $this->form->label($param_desc, $param_name) ?> + <?= $this->form->select('params['.$param_name.']', $priorities_list, $values) ?> <?php elseif ($this->text->contains($param_name, 'duration')): ?> <?= $this->form->label($param_desc, $param_name) ?> <?= $this->form->number('params['.$param_name.']', $values) ?> @@ -49,4 +52,4 @@ <?= t('or') ?> <?= $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/tests/units/Action/CommentCreationMoveTaskColumnTest.php b/tests/units/Action/CommentCreationMoveTaskColumnTest.php index 6464639e..9615865d 100644 --- a/tests/units/Action/CommentCreationMoveTaskColumnTest.php +++ b/tests/units/Action/CommentCreationMoveTaskColumnTest.php @@ -40,7 +40,6 @@ class CommentCreationMoveTaskColumnTest extends Base public function testWithUserNotLogged() { $projectModel = new Project($this->container); - $commentModel = new Comment($this->container); $taskCreationModel = new TaskCreation($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); diff --git a/tests/units/Action/CommentCreationTest.php b/tests/units/Action/CommentCreationTest.php index 042a8f8b..a2e52dc6 100644 --- a/tests/units/Action/CommentCreationTest.php +++ b/tests/units/Action/CommentCreationTest.php @@ -46,7 +46,6 @@ class CommentCreationTest extends Base { $userModel = new User($this->container); $projectModel = new Project($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); $commentModel = new Comment($this->container); $taskCreationModel = new TaskCreation($this->container); @@ -74,8 +73,6 @@ class CommentCreationTest extends Base { $userModel = new User($this->container); $projectModel = new Project($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); - $commentModel = new Comment($this->container); $taskCreationModel = new TaskCreation($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); diff --git a/tests/units/Action/TaskAssignCategoryColorTest.php b/tests/units/Action/TaskAssignCategoryColorTest.php index bd8181e8..b386d9bf 100644 --- a/tests/units/Action/TaskAssignCategoryColorTest.php +++ b/tests/units/Action/TaskAssignCategoryColorTest.php @@ -42,7 +42,6 @@ class TaskAssignCategoryColorTest extends Base $categoryModel = new Category($this->container); $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskAssignCategoryLabelTest.php b/tests/units/Action/TaskAssignCategoryLabelTest.php index bf8bdb5b..ba988a72 100644 --- a/tests/units/Action/TaskAssignCategoryLabelTest.php +++ b/tests/units/Action/TaskAssignCategoryLabelTest.php @@ -42,7 +42,6 @@ class TaskAssignCategoryLabelTest extends Base $categoryModel = new Category($this->container); $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -64,7 +63,6 @@ class TaskAssignCategoryLabelTest extends Base $categoryModel = new Category($this->container); $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1))); diff --git a/tests/units/Action/TaskAssignCategoryLinkTest.php b/tests/units/Action/TaskAssignCategoryLinkTest.php index da83d541..ba0e7152 100644 --- a/tests/units/Action/TaskAssignCategoryLinkTest.php +++ b/tests/units/Action/TaskAssignCategoryLinkTest.php @@ -70,7 +70,6 @@ class TaskAssignCategoryLinkTest extends Base public function testThatExistingCategoryWillNotChange() { $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); $p = new Project($this->container); $c = new Category($this->container); diff --git a/tests/units/Action/TaskAssignColorCategoryTest.php b/tests/units/Action/TaskAssignColorCategoryTest.php index 9f188645..86c855d1 100644 --- a/tests/units/Action/TaskAssignColorCategoryTest.php +++ b/tests/units/Action/TaskAssignColorCategoryTest.php @@ -39,10 +39,8 @@ class TaskAssignColorCategoryTest extends Base public function testWithWrongCategory() { - $categoryModel = new Category($this->container); $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskAssignColorColumnTest.php b/tests/units/Action/TaskAssignColorColumnTest.php index e5858b19..130422b5 100644 --- a/tests/units/Action/TaskAssignColorColumnTest.php +++ b/tests/units/Action/TaskAssignColorColumnTest.php @@ -38,7 +38,6 @@ class TaskAssignColorColumnTest extends Base { $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskAssignColorLinkTest.php b/tests/units/Action/TaskAssignColorLinkTest.php index d89c8b06..6df029d3 100644 --- a/tests/units/Action/TaskAssignColorLinkTest.php +++ b/tests/units/Action/TaskAssignColorLinkTest.php @@ -38,7 +38,6 @@ class TaskAssignColorLinkTest extends Base { $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskAssignColorPriorityTest.php b/tests/units/Action/TaskAssignColorPriorityTest.php new file mode 100644 index 00000000..be6d8727 --- /dev/null +++ b/tests/units/Action/TaskAssignColorPriorityTest.php @@ -0,0 +1,57 @@ +<?php + +require_once __DIR__.'/../Base.php'; + +use Kanboard\Event\GenericEvent; +use Kanboard\Model\Category; +use Kanboard\Model\TaskCreation; +use Kanboard\Model\TaskFinder; +use Kanboard\Model\Project; +use Kanboard\Model\Task; +use Kanboard\Action\TaskAssignColorPriority; + +class TaskAssignColorPriorityTest extends Base +{ + public function testChangeColor() + { + $categoryModel = new Category($this->container); + $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreation($this->container); + $taskFinderModel = new TaskFinder($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); + $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); + $this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1))); + + $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'priority' => 1)); + + $action = new TaskAssignColorPriority($this->container); + $action->setProjectId(1); + $action->setParam('color_id', 'red'); + $action->setParam('priority', 1); + + $this->assertTrue($action->execute($event, Task::EVENT_CREATE_UPDATE)); + + $task = $taskFinderModel->getById(1); + $this->assertNotEmpty($task); + $this->assertEquals('red', $task['color_id']); + } + + public function testWithWrongPriority() + { + $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreation($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); + $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); + + $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'priority' => 2)); + + $action = new TaskAssignColorPriority($this->container); + $action->setProjectId(1); + $action->setParam('color_id', 'red'); + $action->setParam('priority', 1); + + $this->assertFalse($action->execute($event, Task::EVENT_CREATE_UPDATE)); + } +} diff --git a/tests/units/Action/TaskAssignColorUserTest.php b/tests/units/Action/TaskAssignColorUserTest.php index e2656cc0..76e2282c 100644 --- a/tests/units/Action/TaskAssignColorUserTest.php +++ b/tests/units/Action/TaskAssignColorUserTest.php @@ -38,7 +38,6 @@ class TaskAssignColorUserTest extends Base { $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskAssignCurrentUserColumnTest.php b/tests/units/Action/TaskAssignCurrentUserColumnTest.php index 41576ee4..a741076b 100644 --- a/tests/units/Action/TaskAssignCurrentUserColumnTest.php +++ b/tests/units/Action/TaskAssignCurrentUserColumnTest.php @@ -41,7 +41,6 @@ class TaskAssignCurrentUserColumnTest extends Base $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -59,7 +58,6 @@ class TaskAssignCurrentUserColumnTest extends Base { $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskAssignCurrentUserTest.php b/tests/units/Action/TaskAssignCurrentUserTest.php index 2fe84a5d..2f4b235f 100644 --- a/tests/units/Action/TaskAssignCurrentUserTest.php +++ b/tests/units/Action/TaskAssignCurrentUserTest.php @@ -38,7 +38,6 @@ class TaskAssignCurrentUserTest extends Base { $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskAssignSpecificUserTest.php b/tests/units/Action/TaskAssignSpecificUserTest.php index 67b2c397..7741e983 100644 --- a/tests/units/Action/TaskAssignSpecificUserTest.php +++ b/tests/units/Action/TaskAssignSpecificUserTest.php @@ -38,7 +38,6 @@ class TaskAssignSpecificUserTest extends Base { $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskAssignUserTest.php b/tests/units/Action/TaskAssignUserTest.php index 31404c0b..d723ed2b 100644 --- a/tests/units/Action/TaskAssignUserTest.php +++ b/tests/units/Action/TaskAssignUserTest.php @@ -41,11 +41,8 @@ class TaskAssignUserTest extends Base public function testWithNotAssignableUser() { - $userModel = new User($this->container); $projectModel = new Project($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskCloseColumnTest.php b/tests/units/Action/TaskCloseColumnTest.php index ce41bb41..654aeec1 100644 --- a/tests/units/Action/TaskCloseColumnTest.php +++ b/tests/units/Action/TaskCloseColumnTest.php @@ -37,7 +37,6 @@ class TaskCloseColumnTest extends Base { $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskCreationTest.php b/tests/units/Action/TaskCreationTest.php index 57c2995d..57a3ee46 100644 --- a/tests/units/Action/TaskCreationTest.php +++ b/tests/units/Action/TaskCreationTest.php @@ -34,7 +34,6 @@ class TaskCreationActionTest extends Base public function testWithNoTitle() { $projectModel = new Project($this->container); - $taskFinderModel = new TaskFinder($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); diff --git a/tests/units/Action/TaskDuplicateAnotherProjectTest.php b/tests/units/Action/TaskDuplicateAnotherProjectTest.php index d9491dd9..d5f99ec9 100644 --- a/tests/units/Action/TaskDuplicateAnotherProjectTest.php +++ b/tests/units/Action/TaskDuplicateAnotherProjectTest.php @@ -39,7 +39,6 @@ class TaskDuplicateAnotherProjectTest extends Base public function testWithWrongColumn() { $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); diff --git a/tests/units/Action/TaskEmailTest.php b/tests/units/Action/TaskEmailTest.php index ef32a296..93b7b559 100644 --- a/tests/units/Action/TaskEmailTest.php +++ b/tests/units/Action/TaskEmailTest.php @@ -44,7 +44,6 @@ class TaskEmailTest extends Base public function testWithWrongColumn() { $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); diff --git a/tests/units/Action/TaskMoveAnotherProjectTest.php b/tests/units/Action/TaskMoveAnotherProjectTest.php index dfabe5f8..ec48f0a4 100644 --- a/tests/units/Action/TaskMoveAnotherProjectTest.php +++ b/tests/units/Action/TaskMoveAnotherProjectTest.php @@ -40,7 +40,6 @@ class TaskMoveAnotherProjectTest extends Base public function testWithWrongColumn() { $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); diff --git a/tests/units/Action/TaskMoveColumnAssignedTest.php b/tests/units/Action/TaskMoveColumnAssignedTest.php index f0eec894..3b325505 100644 --- a/tests/units/Action/TaskMoveColumnAssignedTest.php +++ b/tests/units/Action/TaskMoveColumnAssignedTest.php @@ -39,7 +39,6 @@ class TaskMoveColumnAssignedTest extends Base public function testWithWrongColumn() { $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); diff --git a/tests/units/Action/TaskMoveColumnCategoryChangeTest.php b/tests/units/Action/TaskMoveColumnCategoryChangeTest.php index 1f0768c1..8783c679 100644 --- a/tests/units/Action/TaskMoveColumnCategoryChangeTest.php +++ b/tests/units/Action/TaskMoveColumnCategoryChangeTest.php @@ -43,7 +43,6 @@ class TaskMoveColumnCategoryChangeTest extends Base { $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $categoryModel = new Category($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -65,7 +64,6 @@ class TaskMoveColumnCategoryChangeTest extends Base { $projectModel = new Project($this->container); $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); $categoryModel = new Category($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); diff --git a/tests/units/Action/TaskMoveColumnUnAssignedTest.php b/tests/units/Action/TaskMoveColumnUnAssignedTest.php index 0b54b781..cf2333cc 100644 --- a/tests/units/Action/TaskMoveColumnUnAssignedTest.php +++ b/tests/units/Action/TaskMoveColumnUnAssignedTest.php @@ -39,7 +39,6 @@ class TaskMoveColumnUnAssignedTest extends Base public function testWithWrongColumn() { $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -57,7 +56,6 @@ class TaskMoveColumnUnAssignedTest extends Base public function testWithWrongUser() { $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); diff --git a/tests/units/Model/ProjectTest.php b/tests/units/Model/ProjectTest.php index 5478fa40..b3dcd2e5 100644 --- a/tests/units/Model/ProjectTest.php +++ b/tests/units/Model/ProjectTest.php @@ -315,6 +315,11 @@ class ProjectTest extends Base $this->assertEquals(0, $project['priority_start']); $this->assertEquals(3, $project['priority_end']); + $this->assertEquals( + array(0 => 0, 1 => 1, 2 => 2, 3 => 3), + $projectModel->getPriorities($project) + ); + $this->assertTrue($projectModel->update(array('id' => 1, 'priority_start' => 2, 'priority_end' => 5, 'priority_default' => 4))); $project = $projectModel->getById(1); @@ -322,5 +327,10 @@ class ProjectTest extends Base $this->assertEquals(4, $project['priority_default']); $this->assertEquals(2, $project['priority_start']); $this->assertEquals(5, $project['priority_end']); + + $this->assertEquals( + array(2 => 2, 3 => 3, 4 => 4, 5 => 5), + $projectModel->getPriorities($project) + ); } } |