From 6067378d265fb5e13ac0e433dacbf4650a6a532b Mon Sep 17 00:00:00 2001 From: tianshujie Date: Sat, 23 Dec 2023 15:09:22 +0800 Subject: [PATCH] * Fix test unit error. --- module/productplan/model.php | 6 +++--- module/productplan/test/model/linkstory.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/productplan/model.php b/module/productplan/model.php index 9702601562..e3dafa249c 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -405,7 +405,7 @@ class productplanModel extends model */ public function create(object $plan, int $isFuture): int|false { - $product = $this->loadModel('product')->getByID($plan->product); + $product = $this->loadModel('product')->getByID((int)$plan->product); if($product->type != 'normal' && $plan->branch == '') { $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]); @@ -427,7 +427,7 @@ class productplanModel extends model $plan->begin = $isFuture || empty($plan->begin) ? $this->config->productplan->future : $plan->begin; $plan->end = $isFuture || empty($plan->end) ? $this->config->productplan->future : $plan->end; - $plan = $this->loadModel('file')->processImgURL($plan, $this->config->productplan->editor->create['id'], $this->post->uid); + $plan = $this->loadModel('file')->processImgURL($plan, $this->config->productplan->editor->create['id'], (string)$this->post->uid); $this->dao->insert(TABLE_PRODUCTPLAN)->data($plan) ->autoCheck() ->batchCheck($this->config->productplan->create->requiredFields, 'notempty') @@ -484,7 +484,7 @@ class productplanModel extends model } if(dao::isError()) return false; - $plan = $this->loadModel('file')->processImgURL($plan, $this->config->productplan->editor->edit['id'], $this->post->uid); + $plan = $this->loadModel('file')->processImgURL($plan, $this->config->productplan->editor->edit['id'], (string)$this->post->uid); $this->dao->update(TABLE_PRODUCTPLAN)->data($plan) ->autoCheck() ->batchCheck($this->config->productplan->edit->requiredFields, 'notempty') diff --git a/module/productplan/test/model/linkstory.php b/module/productplan/test/model/linkstory.php index 21cda90d2f..f0cbb485c1 100755 --- a/module/productplan/test/model/linkstory.php +++ b/module/productplan/test/model/linkstory.php @@ -27,5 +27,5 @@ $storyIdList[] = array(4); $storyIdList[] = array(1111); $plan = new productPlan('admin'); -r($plan->linkStory($planID[0], $storyIdList[0])) && p('4:plan,story,order') && e('2,4,1'); //关联计划id为2的需求4 +r($plan->linkStory($planID[0], $storyIdList[0])) && p('4:plan,story,order') && e('2,4,2'); //关联计划id为2的需求4 r($plan->linkStory($planID[1], $storyIdList[1])) && p() && e('0'); //传入不存在id的情况