* Add comments for bug::getLinkedExecutionByIdList, and add its unit test.
This commit is contained in:
@@ -1347,4 +1347,31 @@ class bugTest
|
||||
return $build;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试通过版本 id 列表获取版本关联的执行。
|
||||
* Test get linked execution by id list.
|
||||
*
|
||||
* @param string $buildIdList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getLinkedExecutionByIdListTest(string $buildIdList): array|string
|
||||
{
|
||||
$buildIdList = explode(',', $buildIdList);
|
||||
$array = $this->objectModel->getLinkedExecutionByIdList($buildIdList);
|
||||
|
||||
$idList = '';
|
||||
foreach($array as $execution) $idList .= ',' . $execution;
|
||||
$idList = trim($idList, ',');
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $idList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/bug.class.php';
|
||||
|
||||
zdTable('build')->config('build')->gen(100);
|
||||
|
||||
/**
|
||||
|
||||
title=bugModel->getLinkedExecutionByIdList();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
- 测试获取版本ID 1 3 5 的执行 @1,3
|
||||
|
||||
|
||||
- 测试获取版本ID 2 4 6 的执行 @2,4
|
||||
|
||||
|
||||
- 测试获取版本ID 41 51 61 的执行 @39,49,59,2
|
||||
|
||||
|
||||
- 测试获取版本ID 10 30 70 的执行 @8,28,68,2
|
||||
|
||||
|
||||
- 测试获取版本ID 不存在 的执行 @0
|
||||
|
||||
*/
|
||||
|
||||
$builds = array('', '1,3,5', '2,4,6', '41,51,61', '10,30,70', '1000001,100002');
|
||||
|
||||
$bug=new bugTest();
|
||||
r($bug->getLinkedExecutionByIdListTest($builds[1])) && p() && e('1,3'); // 测试获取版本ID 1 3 5 的执行
|
||||
r($bug->getLinkedExecutionByIdListTest($builds[2])) && p() && e('2,4'); // 测试获取版本ID 2 4 6 的执行
|
||||
r($bug->getLinkedExecutionByIdListTest($builds[3])) && p() && e('39,49,59,2'); // 测试获取版本ID 41 51 61 的执行
|
||||
r($bug->getLinkedExecutionByIdListTest($builds[4])) && p() && e('8,28,68,2'); // 测试获取版本ID 10 30 70 的执行
|
||||
r($bug->getLinkedExecutionByIdListTest($builds[5])) && p() && e('0'); // 测试获取版本ID 不存在 的执行
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php'; su('admin');
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/bug.class.php';
|
||||
|
||||
zdTable('bug')->gen(140);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: zt_build
|
||||
author: Mengyi Liu
|
||||
version: "1.0"
|
||||
fields:
|
||||
- field: execution
|
||||
range: 0{2},1-90
|
||||
- field: builds
|
||||
fields:
|
||||
- field: build1
|
||||
range: "``{50}, `,`{50}"
|
||||
- field: build2
|
||||
range: "``{50}, 2-100:2{50}"
|
||||
- field: build3
|
||||
range: "``{50}, `,`{50}"
|
||||
- field: build4
|
||||
range: "``{50}, 4-100:2{50}"
|
||||
- field: build5
|
||||
range: "``{50}, `,`{50}"
|
||||
|
||||
Reference in New Issue
Block a user