* Adjust unit test of getParentChildrenTypesTest().

This commit is contained in:
xushenjie
2023-05-11 08:50:51 +00:00
parent b57f08d169
commit 732ba2bdbd
2 changed files with 5 additions and 16 deletions
@@ -17,25 +17,13 @@ title=测试 programplanModel->getParentChildrenTypes();
cid=1
pid=1
查找父ID为 1 未删除的阶段类型 stage >> stage
查找父ID为 1 未删除的阶段类型 kanban >> kanban
查找父ID为 1 未删除的阶段类型数量 >> 2
查找父ID为 2 未删除的阶段类型 sprint >> sprint
查找父ID为 2 未删除的阶段类型数量 >> 1
查找父ID为 3 未删除的阶段类型 stage >> stage
查找父ID为 3 未删除的阶段类型 sprint >> sprint
查找父ID为 3 未删除的阶段类型数量 >> 2
查找父ID为 1 未删除的阶段类型 stage >> 0
查找父ID为 1 未删除的阶段类型 sprint >> 0
查找父ID为 1 未删除的阶段类型 kanban >> 0
查找父ID为 1 未删除的阶段类型数量 >> 0
*/
$parentIDList = array(1, 2, 3, 4);
$programplan = new programplanTest();
r($programplan->getParentChildrenTypesTest(0)) && p() && e('1'); // 查找父ID为 0 未删除的阶段类型
r($programplan->getParentChildrenTypesTest($parentIDList[0])) && p('stage') && e('stage'); // 查找父ID为 1 未删除的阶段类型 stage
r($programplan->getParentChildrenTypesTest($parentIDList[0])) && p('kanban') && e('kanban'); // 查找父ID为 1 未删除的阶段类型 kanban
r(count($programplan->getParentChildrenTypesTest($parentIDList[0]))) && p() && e('2'); // 查找父ID为 1 未删除的阶段类型数量
@@ -342,17 +342,18 @@ class programplanTest
}
/**
* 测试获取父阶段的子类型。
* Test get parent stage's children types.
*
* @param int $parentID
* @access public
* @return string
* @return array|bool
*/
public function getParentChildrenTypesTest($parentID)
public function getParentChildrenTypesTest(int $parentID): array|bool
{
$objects = $this->objectModel->getParentChildrenTypes($parentID);
if(dao::isError()) return dao::getError();
if(dao::isError()) return false;
return $objects;
}