summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2018-10-02 10:16:30 -0700
committerFrédéric Guillot <fred@kanboard.net>2018-10-02 10:16:30 -0700
commitb6e0b9cc09c3a2853c5b52b9e0f0b845d88d99bf (patch)
treed7dc26966bb83c69e2a460b7464b647574f75c66
parent497f36983c7b02ca8579f785da62efba88e22656 (diff)
Duplicate category color when duplicating projects
-rw-r--r--app/Model/CategoryModel.php2
-rw-r--r--tests/units/Model/CategoryModelTest.php4
2 files changed, 4 insertions, 2 deletions
diff --git a/app/Model/CategoryModel.php b/app/Model/CategoryModel.php
index 024d0026..95e9e97e 100644
--- a/app/Model/CategoryModel.php
+++ b/app/Model/CategoryModel.php
@@ -212,7 +212,7 @@ class CategoryModel extends Base
{
$categories = $this->db
->table(self::TABLE)
- ->columns('name', 'description')
+ ->columns('name', 'description', 'color_id')
->eq('project_id', $src_project_id)
->asc('name')
->findAll();
diff --git a/tests/units/Model/CategoryModelTest.php b/tests/units/Model/CategoryModelTest.php
index 80a20af6..6147b3a5 100644
--- a/tests/units/Model/CategoryModelTest.php
+++ b/tests/units/Model/CategoryModelTest.php
@@ -212,7 +212,7 @@ class CategoryModelTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'Project #1')));
$this->assertEquals(2, $projectModel->create(array('name' => 'Project #2')));
- $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1, 'description' => 'test')));
+ $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1, 'description' => 'test', 'color_id' => 'blue')));
$this->assertTrue($categoryModel->duplicate(1, 2));
@@ -220,10 +220,12 @@ class CategoryModelTest extends Base
$this->assertEquals('Category #1', $category['name']);
$this->assertEquals(1, $category['project_id']);
$this->assertEquals('test', $category['description']);
+ $this->assertEquals('blue', $category['color_id']);
$category = $categoryModel->getById(2);
$this->assertEquals('Category #1', $category['name']);
$this->assertEquals(2, $category['project_id']);
$this->assertEquals('test', $category['description']);
+ $this->assertEquals('blue', $category['color_id']);
}
}