* [perf story #77161] Adjust projectModel getWorkHour unit test.

This commit is contained in:
wangyidong
2025-08-13 10:58:07 +08:00
parent f86f36acf7
commit 0d800981ef
3 changed files with 22 additions and 6 deletions
+1 -1
View File
@@ -272,7 +272,7 @@ class docTao extends docModel
* @access protected
* @return void
*/
public function doUpdateDoc(int $docID, object $doc, $basicInfoChanged = false)
public function doUpdateDoc(int $docID, object $doc, bool $basicInfoChanged = false)
{
$this->dao->update(TABLE_DOC)->data($doc)->autoCheck()->where('id')->eq($docID)->exec();
+2 -2
View File
@@ -684,7 +684,7 @@ class personnelModel extends model
$this->dao->update(TABLE_PRODUCT)->set('whitelist')->eq($newWhitelist)->where('id')->eq($productID)->exec();
$viewProducts = $this->dao->select('products')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('products');
$newViewProducts = trim(str_replace(",{$productID},", '', ",{$viewProducts},"), ',');
$newViewProducts = trim(str_replace(",{$productID},", ',', ",{$viewProducts},"), ',');
$this->dao->update(TABLE_USERVIEW)->set('products')->eq($newViewProducts)->where('account')->eq($account)->exec();
}
@@ -771,7 +771,7 @@ class personnelModel extends model
$this->dao->update(TABLE_PROJECT)->set('whitelist')->eq($newWhitelist)->where('id')->eq($projectID)->exec();
$viewProjects = $this->dao->select('projects')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('projects');
$newViewProjects = trim(str_replace(",{$projectID},", '', ",{$viewProjects},"), ',');
$newViewProjects = trim(str_replace(",{$projectID},", ',', ",{$viewProjects},"), ',');
$this->dao->update(TABLE_USERVIEW)->set('projects')->eq($newViewProjects)->where('account')->eq($account)->exec();
}
}
+19 -3
View File
@@ -13,6 +13,22 @@ title=测试 projectModel::getWorkhour;
timeout=0
cid=1
- 获取不存在项目工时信息
- 属性totalHours @0
- 属性totalEstimate @0
- 属性totalConsumed @0
- 属性totalLeft @0
- 获取项目ID为11的总预计工时
- 属性totalHours @112.5
- 属性totalEstimate @61
- 属性totalConsumed @18
- 属性totalLeft @61
- 获取项目ID为60的总消耗工时
- 属性totalHours @225
- 属性totalEstimate @35
- 属性totalConsumed @11
- 属性totalLeft @35
*/
$projectIdList = array(1, 11, 60);
@@ -20,6 +36,6 @@ $projectIdList = array(1, 11, 60);
global $tester;
$tester->loadModel('project');
r($tester->project->getWorkHour($projectIdList[0])) && p('totalHours') && e('0'); // 获取不存在项目工时信息
r($tester->project->getWorkHour($projectIdList[1])) && p('totalEstimate') && e('61'); // 获取项目ID为11的总预计工时
r($tester->project->getWorkHour($projectIdList[2])) && p('totalConsumed') && e('11'); // 获取项目ID为60的总消耗工时
r($tester->project->getWorkHour($projectIdList[0])) && p('totalHours,totalEstimate,totalConsumed,totalLeft') && e('0,0,0,0'); // 获取不存在项目工时信息
r($tester->project->getWorkHour($projectIdList[1])) && p('totalHours,totalEstimate,totalConsumed,totalLeft') && e('112.5,61,18,61'); // 获取项目ID为11的总预计工时
r($tester->project->getWorkHour($projectIdList[2])) && p('totalHours,totalEstimate,totalConsumed,totalLeft') && e('225,35,11,35'); // 获取项目ID为60的总消耗工时