+ [misc] Add unit tests for bugZen::assignKanbanVars() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -88,4 +88,27 @@ class bugZenTest extends baseTest
|
||||
if(dao::isError()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test assignKanbanVars method.
|
||||
*
|
||||
* @param object $execution
|
||||
* @param array $output
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function assignKanbanVarsTest(object $execution, array $output = array()): array
|
||||
{
|
||||
$instance = $this->getInstance($this->moduleName, $this->className);
|
||||
$this->invokeArgs('assignKanbanVars', [$execution, $output]);
|
||||
if(dao::isError()) return array();
|
||||
|
||||
return array(
|
||||
'executionType' => $instance->view->executionType ?? '',
|
||||
'regionID' => $instance->view->regionID ?? 0,
|
||||
'laneID' => $instance->view->laneID ?? 0,
|
||||
'regionPairs' => !empty($instance->view->regionPairs) ? count($instance->view->regionPairs) : 0,
|
||||
'lanePairs' => !empty($instance->view->lanePairs) ? count($instance->view->lanePairs) : 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 bugZen::assignKanbanVars();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 测试看板类型执行无output参数情况属性executionType @kanban
|
||||
- 测试sprint类型执行无output参数情况属性executionType @sprint
|
||||
- 测试stage类型执行有regionID参数情况
|
||||
- 属性executionType @stage
|
||||
- 属性regionID @5
|
||||
- 测试有groupID参数情况属性executionType @kanban
|
||||
- 测试有regionID和laneID参数情况
|
||||
- 属性executionType @sprint
|
||||
- 属性regionID @3
|
||||
- 属性laneID @10
|
||||
- 测试无区域数据情况
|
||||
- 属性executionType @kanban
|
||||
- 属性regionID @0
|
||||
- 测试无泳道数据情况
|
||||
- 属性executionType @kanban
|
||||
- 属性regionID @99
|
||||
- 属性laneID @0
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/zen.class.php';
|
||||
|
||||
zenData('project')->loadYaml('assignkanbanvars/project', false, 2)->gen(10);
|
||||
zenData('kanbanregion')->loadYaml('assignkanbanvars/kanbanregion', false, 2)->gen(20);
|
||||
zenData('kanbanlane')->loadYaml('assignkanbanvars/kanbanlane', false, 2)->gen(30);
|
||||
zenData('kanbangroup')->loadYaml('assignkanbanvars/kanbangroup', false, 2)->gen(10);
|
||||
|
||||
su('admin');
|
||||
|
||||
$bugTest = new bugZenTest();
|
||||
|
||||
$execution1 = new stdclass();
|
||||
$execution1->id = 1;
|
||||
$execution1->type = 'kanban';
|
||||
|
||||
$execution2 = new stdclass();
|
||||
$execution2->id = 2;
|
||||
$execution2->type = 'sprint';
|
||||
|
||||
$execution3 = new stdclass();
|
||||
$execution3->id = 3;
|
||||
$execution3->type = 'stage';
|
||||
|
||||
$execution4 = new stdclass();
|
||||
$execution4->id = 4;
|
||||
$execution4->type = 'kanban';
|
||||
|
||||
$execution5 = new stdclass();
|
||||
$execution5->id = 5;
|
||||
$execution5->type = 'sprint';
|
||||
|
||||
$execution99 = new stdclass();
|
||||
$execution99->id = 99;
|
||||
$execution99->type = 'kanban';
|
||||
|
||||
r($bugTest->assignKanbanVarsTest($execution1, array())) && p('executionType') && e('kanban'); // 测试看板类型执行无output参数情况
|
||||
r($bugTest->assignKanbanVarsTest($execution2, array())) && p('executionType') && e('sprint'); // 测试sprint类型执行无output参数情况
|
||||
r($bugTest->assignKanbanVarsTest($execution3, array('regionID' => 5))) && p('executionType,regionID') && e('stage,5'); // 测试stage类型执行有regionID参数情况
|
||||
r($bugTest->assignKanbanVarsTest($execution4, array('groupID' => 2))) && p('executionType') && e('kanban'); // 测试有groupID参数情况
|
||||
r($bugTest->assignKanbanVarsTest($execution5, array('regionID' => 3, 'laneID' => 10))) && p('executionType,regionID,laneID') && e('sprint,3,10'); // 测试有regionID和laneID参数情况
|
||||
r($bugTest->assignKanbanVarsTest($execution99, array())) && p('executionType,regionID') && e('kanban,0'); // 测试无区域数据情况
|
||||
r($bugTest->assignKanbanVarsTest($execution1, array('regionID' => 99))) && p('executionType,regionID,laneID') && e('kanban,99,0'); // 测试无泳道数据情况
|
||||
@@ -0,0 +1,182 @@
|
||||
---
|
||||
title: kanban表数据定义
|
||||
desc: 为assignKanbanVars方法测试准备kanban数据
|
||||
author: Claude Code
|
||||
version: 1.0
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
note: 看板ID
|
||||
range: 1-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: space
|
||||
note: 空间ID
|
||||
range: 1-5
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: name
|
||||
note: 看板名称
|
||||
range: "Kanban{1-10}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: owner
|
||||
note: 所有者
|
||||
range: "admin,user1,user2"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: team
|
||||
note: 团队
|
||||
range: "[]"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: status
|
||||
note: 状态
|
||||
range: "active{8},closed{2}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: acl
|
||||
note: 访问控制
|
||||
range: "open{5},private{3},custom{2}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: whitelist
|
||||
note: 白名单
|
||||
range: "[]"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: order
|
||||
note: 排序
|
||||
range: 1-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: displayCards
|
||||
note: 显示卡片数
|
||||
range: 0-20
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: fluidBoard
|
||||
note: 流式看板
|
||||
range: "0{5},1{5}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: colWidth
|
||||
note: 列宽
|
||||
range: 264-320
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: minColWidth
|
||||
note: 最小列宽
|
||||
range: 200-264
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: maxColWidth
|
||||
note: 最大列宽
|
||||
range: 320-400
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: object
|
||||
note: 对象类型
|
||||
range: "execution{10}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: alignment
|
||||
note: 对齐方式
|
||||
range: "center,left,right"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: createdBy
|
||||
note: 创建者
|
||||
range: "admin,user1,user2"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: createdDate
|
||||
note: 创建时间
|
||||
range: "2023-01-01 00:00:00-2023-12-31 23:59:59"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: lastEditedBy
|
||||
note: 最后编辑者
|
||||
range: "admin,user1,user2,[]"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: lastEditedDate
|
||||
note: 最后编辑时间
|
||||
range: "2023-01-01 00:00:00-2023-12-31 23:59:59,0000-00-00 00:00:00"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: closedBy
|
||||
note: 关闭者
|
||||
range: "admin,user1,[]{7}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: closedDate
|
||||
note: 关闭时间
|
||||
range: "2023-01-01 00:00:00-2023-12-31 23:59:59,0000-00-00 00:00:00{7}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: activatedBy
|
||||
note: 激活者
|
||||
range: "admin,[]{9}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: activatedDate
|
||||
note: 激活时间
|
||||
range: "2023-01-01 00:00:00-2023-12-31 23:59:59,0000-00-00 00:00:00{9}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: deleted
|
||||
note: 删除状态
|
||||
range: "0{9},1{1}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
title: kanbangroup表数据定义
|
||||
desc: 为assignKanbanVars方法测试准备kanban分组数据
|
||||
author: Claude Code
|
||||
version: 1.0
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
note: 分组ID
|
||||
range: 1-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: kanban
|
||||
note: 看板ID
|
||||
range: 1-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: region
|
||||
note: 区域ID
|
||||
range: 1-20
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: name
|
||||
note: 分组名称
|
||||
range: "Group{1-10}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: order
|
||||
note: 排序
|
||||
range: 1-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: deleted
|
||||
note: 删除状态
|
||||
range: "0{9},1{1}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
title: kanbanlane表数据定义
|
||||
desc: 为assignKanbanVars方法测试准备kanban泳道数据
|
||||
author: Claude Code
|
||||
version: 1.0
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
note: 泳道ID
|
||||
range: 1-30
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: execution
|
||||
note: 执行ID
|
||||
range: 0
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: type
|
||||
note: 泳道类型
|
||||
range: "bug{30}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: region
|
||||
note: 所属区域ID
|
||||
range: 1-20{2}
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: group
|
||||
note: 分组ID
|
||||
range: 0,1-5
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: groupby
|
||||
note: 分组方式
|
||||
range: "default{20},story{5},module{5}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: name
|
||||
note: 泳道名称
|
||||
range: "Lane{1-30}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: order
|
||||
note: 排序
|
||||
range: 1-30
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: color
|
||||
note: 颜色
|
||||
range: "#FF5722,#4CAF50,#2196F3,#9C27B0,#FF9800"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: lastEditedTime
|
||||
note: 最后编辑时间
|
||||
range: "2023-01-01 00:00:00-2023-12-31 23:59:59"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: deleted
|
||||
note: 删除状态
|
||||
range: "0{29},1{1}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
title: kanbanregion表数据定义
|
||||
desc: 为assignKanbanVars方法测试准备kanban区域数据
|
||||
author: Claude Code
|
||||
version: 1.0
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
note: 区域ID
|
||||
range: 1-20
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: space
|
||||
note: 空间ID
|
||||
range: 0
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: kanban
|
||||
note: 看板ID(对应execution ID)
|
||||
range: 1-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: name
|
||||
note: 区域名称
|
||||
range: "Region{1-20}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: order
|
||||
note: 排序
|
||||
range: 1-20
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: createdBy
|
||||
note: 创建者
|
||||
range: "admin,user1,user2"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: createdDate
|
||||
note: 创建时间
|
||||
range: "2023-01-01 00:00:00-2023-12-31 23:59:59"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: deleted
|
||||
note: 删除状态
|
||||
range: "0{19},1{1}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
title: project表数据定义
|
||||
desc: 为assignKanbanVars方法测试准备project数据
|
||||
author: Claude Code
|
||||
version: 1.0
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
note: 项目ID
|
||||
range: 1-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: name
|
||||
note: 项目名称
|
||||
range: "Project{1-10}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: type
|
||||
note: 项目类型
|
||||
range: "project{5},program{3},sprint{2}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: status
|
||||
note: 项目状态
|
||||
range: "wait{3},doing{5},done{2}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: model
|
||||
note: 项目模型
|
||||
range: "scrum{5},waterfall{3},kanban{2}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: openedBy
|
||||
note: 创建者
|
||||
range: "admin,user1,user2"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: openedDate
|
||||
note: 创建时间
|
||||
range: "2023-01-01 00:00:00-2023-12-31 23:59:59"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: deleted
|
||||
note: 删除状态
|
||||
range: "0{9},1{1}"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
Reference in New Issue
Block a user