* Modify unit test of testreportModel::getCaseIdList.

This commit is contained in:
liumengyi
2023-09-27 09:53:17 +08:00
parent 8d491f9f4c
commit 09536862ef
2 changed files with 10 additions and 17 deletions
+6 -10
View File
@@ -2,6 +2,10 @@
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/testreport.class.php';
zdTable('testreport')->gen(5);
zdTable('user')->gen(1);
su('admin');
/**
@@ -10,19 +14,11 @@ title=测试 testreportModel->getCaseIdList();
timeout=0
cid=1
- 正常查询
- 属性1 @1
- 属性4 @4
- 查询创建者不为自己的数据
- 属性5 @5
- 属性8 @8
- 查询reportID为空的数据 @0
*/
$reportID = array('1', '2', '');
$reportID = array(1, 2, 0);
$testreport = new testreportTest();
r($testreport->getCaseIdListTest($reportID[0])) && p('1,4') && e('1,4'); //正常查询
r($testreport->getCaseIdListTest($reportID[1])) && p('5,8') && e('5,8'); //查询创建者不为自己的数据
r($testreport->getCaseIdListTest($reportID[2])) && p() && e('0'); //查询reportID为空的数据
r($testreport->getCaseIdListTest($reportID[2])) && p() && e('0'); //查询reportID为空的数据
+4 -7
View File
@@ -75,7 +75,6 @@ class testreportTest
* @access public
* @return array|object|false
*/
public function getByIdTest(int $reportID): array|object|false
{
$object = $this->objectModel->getById($reportID);
@@ -117,7 +116,6 @@ class testreportTest
* @access public
* @return array
*/
public function getTaskCasesTest(int $taskID, int $reportID, string $idList = '', object $pager = null): array
{
$tasks = $taskID ? $this->testtask->getByList((array)$taskID) : array();
@@ -129,16 +127,16 @@ class testreportTest
return $objects;
}
/**
* 测试获取测试报告的 caseID 列表。
* Get caseID list.
* Get case id list.
*
* @param int $reportID
* @access public
* @return array
*/
public function getCaseIdListTest($reportID): array
public function getCaseIdListTest(int $reportID): array
{
$objects = $this->objectModel->getCaseIdList($reportID);
@@ -146,6 +144,7 @@ class testreportTest
return $objects;
}
/**
* 获取报告的概况。
* Get result summary.
@@ -155,7 +154,6 @@ class testreportTest
* @access public
* @return string|array
*/
public function getResultSummaryTest(int $taskID, int $reportID): array|string
{
$tasks = $taskID ? $this->testtask->getByList((array)$taskID) : array();
@@ -225,7 +223,6 @@ class testreportTest
* @access public
* @return array|string|false
*/
public function getBugs4TestTest(string $buildIdList, int $productID, int $taskID, string $type = 'build'): array|string|false
{
$task = $this->testtask->getByID($taskID);