From a42f1ea2bd0e208a67ac42a956f3a0bc366256de Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 15 Nov 2015 14:39:12 -0500 Subject: Add unit test for TaskAssignCategoryLink --- app/Action/Base.php | 2 +- app/Action/TaskAssignCategoryLink.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'app/Action') diff --git a/app/Action/Base.php b/app/Action/Base.php index 4d2d6da6..81e2ccc6 100644 --- a/app/Action/Base.php +++ b/app/Action/Base.php @@ -241,7 +241,7 @@ abstract class Base extends \Kanboard\Core\Base } if (DEBUG) { - $this->container['logger']->debug(get_called_class().' => '.($result ? 'true' : 'false')); + $this->logger->debug(get_called_class().' => '.($result ? 'true' : 'false')); } return $result; diff --git a/app/Action/TaskAssignCategoryLink.php b/app/Action/TaskAssignCategoryLink.php index 8398facf..3d00e8d3 100644 --- a/app/Action/TaskAssignCategoryLink.php +++ b/app/Action/TaskAssignCategoryLink.php @@ -9,6 +9,7 @@ use Kanboard\Model\TaskLink; * * @package action * @author Olivier Maridat + * @author Frederic Guillot */ class TaskAssignCategoryLink extends Base { @@ -35,7 +36,7 @@ class TaskAssignCategoryLink extends Base { return array( 'category_id' => t('Category'), - 'link_id' => t('Link id'), + 'link_id' => t('Link type'), ); } @@ -79,6 +80,11 @@ class TaskAssignCategoryLink extends Base */ public function hasRequiredCondition(array $data) { - return $data['link_id'] == $this->getParam('link_id'); + if ($data['link_id'] == $this->getParam('link_id')) { + $task = $this->taskFinder->getById($data['task_id']); + return empty($task['category_id']); + } + + return false; } } -- cgit v1.2.3