+ Add program::updateStats test unit.

This commit is contained in:
tianshujie
2023-11-27 16:30:28 +08:00
parent 8d11fd50e4
commit 6d8442d6b0
3 changed files with 62 additions and 0 deletions
+16
View File
@@ -548,4 +548,20 @@ class programTest
return $summary;
}
/**
* 更新项目集的统计数据。
* Update stats of program.
*
* @param array $projectIdList
* @access public
* @return array
*/
public function updateStatsTest(array $projectIdList): array
{
$this->program->updateStats($projectIdList);
if(dao::isError()) return dao::getError();
return $this->program->dao->select('*')->from(TABLE_PROJECT)->where('type')->eq('project')->beginIF(!empty($projectIdList))->andWhere('id')->in($projectIdList)->fi()->fetchAll('id');
}
}
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env php
<?php
/**
title=测试 programTao::updateStats();
timeout=0
cid=1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/program.class.php';
zdTable('project')->config('program')->gen(20);
zdTable('task')->config('task')->gen(20);
zdTable('team')->config('team')->gen(30);
zdTable('user')->gen(5);
su('admin');
$projectIdList[] = array();
$projectIdList[] = array(60);
$programTester = new programTest();
r($programTester->updateStatsTest($projectIdList[0])) && p('11:estimate,left,consumed,teamCount') && e('46,39,13,4'); // 获取系统中所有项目的任务统计信息
r($programTester->updateStatsTest($projectIdList[1])) && p('60:estimate,left,consumed,teamCount') && e('18,15,7,0'); // 获取系统中项目ID=60的任务统计信息
+21
View File
@@ -0,0 +1,21 @@
title: team.
desc: team data.
author: Sun Guangming
version: "1.0"
fields:
- field: id
range: 1-1000
- field: root
range: 11{5},60{5},61{10},100{10},101-700
- field: type
range: project{30},execution{600}
- field: account
fields:
- field: account1
range: user{20},test{20},dev{100},pm{100},po{100},td{100},pd{100},qd{100},top{100},outside{100},others{100},a,bb,ccc,qwuiadsd?!2as@#%$aasd~aj1!@#1
- field: account2
range: "1-20,1-20,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,[]{4}"
- field: role
range: "研发{20},测试{20},开发{20},项目经理{100},产品经理{100},其他{1000}"
- field: hours
range: '7.5'