* Optimize unit test script.
This commit is contained in:
@@ -1411,10 +1411,11 @@ class bugTest
|
||||
*/
|
||||
public function getActivatedBugsTest(string $productIdList, string $begin = '', string $end = '', string $buildIdList = ''): string
|
||||
{
|
||||
if($begin == 'lastweek') $begin = date('Y-m-d', strtotime('-7 days'));
|
||||
if($begin == 'lastmonth') $begin = date('Y-m-d', strtotime('-30 days'));
|
||||
if($end == 'nextweek') $end = date('Y-m-d', strtotime('+7 days'));
|
||||
if($end == 'nextmonth') $end = date('Y-m-d', strtotime('+30 days'));
|
||||
$date = '2025-05-01';
|
||||
if($begin == 'lastweek') $begin = date('Y-m-d', strtotime($date . '-7 days'));
|
||||
if($begin == 'lastmonth') $begin = date('Y-m-d', strtotime($date . '-30 days'));
|
||||
if($end == 'nextweek') $end = date('Y-m-d', strtotime($date . '+7 days'));
|
||||
if($end == 'nextmonth') $end = date('Y-m-d', strtotime($date . '+30 days'));
|
||||
$bugs = $this->objectModel->getActivatedBugs(explode(',', $productIdList), $begin, $end, explode(',', $buildIdList));
|
||||
if(dao::isError()) return dao::getError();
|
||||
return implode(',', array_column($bugs, 'id'));
|
||||
|
||||
@@ -4,7 +4,9 @@ include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/bug.unittest.class.php';
|
||||
|
||||
zenData('bug')->gen(30);
|
||||
zenData('action')->loadYaml('action')->gen(100);
|
||||
$action = zenData('action')->loadYaml('action');
|
||||
$action->date->range("20250401 000000-20250601 000000:1D")->type('timestamp')->format('YY-MM-DD hh:mm:ss');
|
||||
$action->gen(100);
|
||||
zenData('history')->loadYaml('history')->gen(100);
|
||||
zenData('user')->gen(1);
|
||||
|
||||
@@ -16,10 +18,10 @@ title=bugModel->getActivatedBugs();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试获取产品 1 2 3 类型 空 开始日期 上月 结束日期 下月 的bug @2,5,6,9
|
||||
- 测试获取产品 1 2 3 类型 空 开始日期 上月 结束日期 下月 的bug @1,2,5,6,9
|
||||
|
||||
- 测试获取产品 1 2 3 类型 空 开始日期 上周 结束日期 下周 的bug @0
|
||||
- 测试获取产品 1 2 3 类型 resolved 开始日期 上月 结束日期 下月 的bug @5,6,9
|
||||
- 测试获取产品 1 2 3 类型 resolved 开始日期 上月 结束日期 下月 的bug @1,5,6,9
|
||||
|
||||
- 测试获取产品 1 2 3 类型 resolved 开始日期 上周 结束日期 下周 的bug @0
|
||||
- 测试获取产品 1 2 3 类型 opened 开始日期 上月 结束日期 下月 的bug @2,5,6,9
|
||||
@@ -62,9 +64,9 @@ $buildIdList = array('1,0,trunk', '1,trunk', '0,trunk');
|
||||
|
||||
$bug = new bugTest();
|
||||
|
||||
r($bug->getActivatedBugsTest($productIdList[0], $beginList[0], $endList[0], $buildIdList[0])) && p() && e('2,5,6,9'); // 测试获取产品 1 2 3 类型 空 开始日期 上月 结束日期 下月 的bug
|
||||
r($bug->getActivatedBugsTest($productIdList[0], $beginList[0], $endList[0], $buildIdList[0])) && p() && e('1,2,5,6,9'); // 测试获取产品 1 2 3 类型 空 开始日期 上月 结束日期 下月 的bug
|
||||
r($bug->getActivatedBugsTest($productIdList[0], $beginList[1], $endList[1], $buildIdList[0])) && p() && e('0'); // 测试获取产品 1 2 3 类型 空 开始日期 上周 结束日期 下周 的bug
|
||||
r($bug->getActivatedBugsTest($productIdList[0], $beginList[0], $endList[0], $buildIdList[1])) && p() && e('5,6,9'); // 测试获取产品 1 2 3 类型 resolved 开始日期 上月 结束日期 下月 的bug
|
||||
r($bug->getActivatedBugsTest($productIdList[0], $beginList[0], $endList[0], $buildIdList[1])) && p() && e('1,5,6,9'); // 测试获取产品 1 2 3 类型 resolved 开始日期 上月 结束日期 下月 的bug
|
||||
r($bug->getActivatedBugsTest($productIdList[0], $beginList[1], $endList[1], $buildIdList[1])) && p() && e('0'); // 测试获取产品 1 2 3 类型 resolved 开始日期 上周 结束日期 下周 的bug
|
||||
r($bug->getActivatedBugsTest($productIdList[0], $beginList[0], $endList[0], $buildIdList[2])) && p() && e('2,5,6,9'); // 测试获取产品 1 2 3 类型 opened 开始日期 上月 结束日期 下月 的bug
|
||||
r($bug->getActivatedBugsTest($productIdList[0], $beginList[1], $endList[1], $buildIdList[2])) && p() && e('0'); // 测试获取产品 1 2 3 类型 opened 开始日期 上周 结束日期 下周 的bug
|
||||
|
||||
Reference in New Issue
Block a user