* [unittest] fix updateproducts file error.

This commit is contained in:
tianshujie
2025-09-22 15:21:41 +08:00
parent 07835e7aff
commit 3aeee0313d
2 changed files with 22 additions and 1 deletions
@@ -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();
}
}
+1 -1
View File
@@ -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]);