From 3aeee0313d319c98c331ea5f02177623f8eb75af Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 22 Sep 2025 14:37:36 +0800 Subject: [PATCH] * [unittest] fix updateproducts file error. --- .../test/lib/project.unittest.class.php | 21 +++++++++++++++++++ module/project/test/model/updateproducts.php | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/module/project/test/lib/project.unittest.class.php b/module/project/test/lib/project.unittest.class.php index 62b5bd0fa2..229fc7c66f 100644 --- a/module/project/test/lib/project.unittest.class.php +++ b/module/project/test/lib/project.unittest.class.php @@ -923,4 +923,25 @@ class projectTest $actions = $this->objectModel->buildActionList($project); return current($actions); } + + /** + * 更新项目关联的产品信息。 + * Update products of a project. + * + * @param int $projectID + * @param array $products + * @param array $otherProducts + * @access public + * @return array + */ + public function updateProductsTest(int $projectID, array $products = array(), array $otherProducts = array()): array + { + $_POST['stageBy'] = 'product'; + if(!empty($otherProducts)) $_POST['otherProducts'] = $otherProducts; + if(!empty($products)) $_POST['products'] = $products; + + $this->objectModel->updateProducts($projectID, $products); + + return $this->objectModel->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($projectID)->fetchAll(); + } } diff --git a/module/project/test/model/updateproducts.php b/module/project/test/model/updateproducts.php index b4bddcde15..59ce442dff 100755 --- a/module/project/test/model/updateproducts.php +++ b/module/project/test/model/updateproducts.php @@ -52,7 +52,7 @@ $projectIdList = array(11, 60, 100); $productIdList = array(0, 1, 2, 3); $otherProductIdList = array('4', '5', '6', '7'); -$projectTester = new Project(); +$projectTester = new projectTest(); $noLinkProduct[0] = $projectTester->updateProductsTest($projectIdList[0]); $noLinkProduct[1] = $projectTester->updateProductsTest($projectIdList[1]); $noLinkProduct[2] = $projectTester->updateProductsTest($projectIdList[2]);