+ [misc] Add unit tests for kanbanTao::refreshERURCards() method

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-11-07 10:30:54 +08:00
co-authored by Claude
parent fe53cf8a0f
commit 43b897f56c
8 changed files with 453 additions and 12 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ timeout=0
cid=1
- 测试获取id为1的action的基本信息
- 属性id @3
- 属性id @1
- 属性objectType @product
- 属性objectID @1
- 属性action @common
@@ -23,7 +23,7 @@ cid=1
- 属性objectType @productplan
- 属性objectID @3
- 属性action @opened
- 测试获取id为0的action的基本信息,由于id为0的action不存在,所以返回false @
- 测试获取id为0的action的基本信息,由于id为0的action不存在,所以返回false @0
*/
@@ -39,4 +39,4 @@ $actionTest = new actionTest();
r($actionTest->fetchBaseInfo($actionIDList[0])) && p('id,objectType,objectID,action') && e('1,product,1,common'); //测试获取id为1的action的基本信息
r($actionTest->fetchBaseInfo($actionIDList[1])) && p('id,objectType,objectID,action') && e('2,story,2,extra'); //测试获取id为2的action的基本信息
r($actionTest->fetchBaseInfo($actionIDList[2])) && p('id,objectType,objectID,action') && e('3,productplan,3,opened'); //测试获取id为3的action的基本信息
r($actionTest->fetchBaseInfo($actionIDList[3])) && p('') && e(0); //测试获取id为0的action的基本信息,由于id为0的action不存在,所以返回false
r($actionTest->fetchBaseInfo($actionIDList[3])) && p('') && e(0); //测试获取id为0的action的基本信息,由于id为0的action不存在,所以返回false
@@ -4,15 +4,17 @@ declare(strict_types=1);
/**
title=测试 actionTao::processCreateChildrenActionExtra();
title=- 执行actionTest模块的processCreateChildrenActionExtraTest方法,参数是'1' 属性extra @
timeout=0
cid=0
cid=1
- 测试单个子任务ID >> 期望返回单个任务信息
- 测试多个子任务ID >> 期望返回多个任务信息用逗号分隔
- 测试不存在的任务ID >> 期望返回空字符串
- 测试空字符串 >> 期望返回空字符串
- 测试混合存在和不存在的任务ID >> 期望只返回存在的任务信息
- 执行actionTest模块的processCreateChildrenActionExtraTest方法,参数是'1' 属性extra @#1 开发任务11
- 执行actionTest模块的processCreateChildrenActionExtraTest方法,参数是'1, 2, 3'
- 属性extra @#1 开发任务11
- 执行actionTest模块的processCreateChildrenActionExtraTest方法,参数是'999' 属性extra @0
- 执行actionTest模块的processCreateChildrenActionExtraTest方法,参数是'' 属性extra @0
- 执行actionTest模块的processCreateChildrenActionExtraTest方法,参数是'1, 999, 2'
- 属性extra @#1 开发任务11
*/
@@ -30,4 +32,4 @@ r($actionTest->processCreateChildrenActionExtraTest('1')) && p('extra') && e('#1
r($actionTest->processCreateChildrenActionExtraTest('1,2,3')) && p('extra') && e('#1 开发任务11, #2 开发任务12, #3 开发任务13');
r($actionTest->processCreateChildrenActionExtraTest('999')) && p('extra') && e('0');
r($actionTest->processCreateChildrenActionExtraTest('')) && p('extra') && e('0');
r($actionTest->processCreateChildrenActionExtraTest('1,999,2')) && p('extra') && e('#1 开发任务11, #2 开发任务12');
r($actionTest->processCreateChildrenActionExtraTest('1,999,2')) && p('extra') && e('#1 开发任务11, #2 开发任务12');
+17
View File
@@ -23,4 +23,21 @@ class kanbanTaoTest extends baseTest
if(dao::isError()) return dao::getError();
return $result;
}
/**
* Test refreshERURCards method.
*
* @param array $cardPairs 卡片对集合
* @param int $executionID 执行ID
* @param string $otherCardList 其他卡片列表
* @param string $laneType 泳道类型
* @access public
* @return array
*/
public function refreshERURCardsTest($cardPairs = array(), $executionID = 0, $otherCardList = '', $laneType = 'story')
{
$result = $this->invokeArgs('refreshERURCards', [$cardPairs, $executionID, $otherCardList, $laneType]);
if(dao::isError()) return dao::getError();
return $result;
}
}
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env php
<?php
/**
title=测试 kanbanTao::refreshERURCards();
timeout=0
cid=0
- 执行kanbanTest模块的refreshERURCardsTest方法,参数是$cardPairs0, 999, '', 'story' @7
- 执行kanbanTest模块的refreshERURCardsTest方法,参数是$cardPairs1, 101, '', 'story'
- 属性wait @,2,1,
- 执行kanbanTest模块的refreshERURCardsTest方法,参数是$cardPairs2, 101, '', 'story'
- 属性planned @,3,
- 执行kanbanTest模块的refreshERURCardsTest方法,参数是$cardPairs3, 101, '', 'story' 属性projected @~~
- 执行kanbanTest模块的refreshERURCardsTest方法,参数是$cardPairs4, 101, '', 'story' 属性developing @~~
- 执行kanbanTest模块的refreshERURCardsTest方法,参数是$cardPairs5, 101, '', 'story' 属性delivering @~~
- 执行kanbanTest模块的refreshERURCardsTest方法,参数是$cardPairs6, 101, '', 'story' 属性delivered @~~
- 执行kanbanTest模块的refreshERURCardsTest方法,参数是$cardPairs7, 101, '', 'parentStory'
- 属性wait @,10,9,
- 执行kanbanTest模块的refreshERURCardsTest方法,参数是$cardPairs8, 101, '', 'epic'
- 属性wait @,8,7,6,
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/kanban.unittest.class.php';
su('admin');
$kanbanTest = new kanbanTest();
$cardPairs0 = array('wait' => '', 'planned' => '', 'projected' => '', 'developing' => '', 'delivering' => '', 'delivered' => '', 'closed' => '');
$cardPairs1 = array('wait' => '', 'planned' => '', 'projected' => '', 'developing' => '', 'delivering' => '', 'delivered' => '', 'closed' => '');
$cardPairs2 = array('wait' => '', 'planned' => '', 'projected' => '', 'developing' => '', 'delivering' => '', 'delivered' => '', 'closed' => '');
$cardPairs3 = array('wait' => '', 'planned' => '', 'projected' => '', 'developing' => '', 'delivering' => '', 'delivered' => '', 'closed' => '');
$cardPairs4 = array('wait' => '', 'planned' => '', 'projected' => '', 'developing' => '', 'delivering' => '', 'delivered' => '', 'closed' => '');
$cardPairs5 = array('wait' => '', 'planned' => '', 'projected' => '', 'developing' => '', 'delivering' => '', 'delivered' => '', 'closed' => '');
$cardPairs6 = array('wait' => '', 'planned' => '', 'projected' => '', 'developing' => '', 'delivering' => '', 'delivered' => '', 'closed' => '');
$cardPairs7 = array('wait' => '', 'planned' => '', 'projected' => '', 'developing' => '', 'delivering' => '', 'delivered' => '', 'closed' => '');
$cardPairs8 = array('wait' => '', 'planned' => '', 'projected' => '', 'developing' => '', 'delivering' => '', 'delivered' => '', 'closed' => '');
r(count($kanbanTest->refreshERURCardsTest($cardPairs0, 999, '', 'story'))) && p() && e('7');
r($kanbanTest->refreshERURCardsTest($cardPairs1, 101, '', 'story')) && p('wait') && e(',2,1,');
r($kanbanTest->refreshERURCardsTest($cardPairs2, 101, '', 'story')) && p('planned') && e(',3,');
r($kanbanTest->refreshERURCardsTest($cardPairs3, 101, '', 'story')) && p('projected') && e('~~');
r($kanbanTest->refreshERURCardsTest($cardPairs4, 101, '', 'story')) && p('developing') && e('~~');
r($kanbanTest->refreshERURCardsTest($cardPairs5, 101, '', 'story')) && p('delivering') && e('~~');
r($kanbanTest->refreshERURCardsTest($cardPairs6, 101, '', 'story')) && p('delivered') && e('~~');
r($kanbanTest->refreshERURCardsTest($cardPairs7, 101, '', 'parentStory')) && p('wait') && e(',10,9,');
r($kanbanTest->refreshERURCardsTest($cardPairs8, 101, '', 'epic')) && p('wait') && e(',8,7,6,');
@@ -0,0 +1,236 @@
---
title: Project数据用于测试refreshERURCards方法
author: Claude
version: 1.0
fields:
- field: id
note: 项目ID
range: 101
prefix: ""
postfix: ""
- field: project
note: 项目
range: '0'
prefix: ""
postfix: ""
- field: model
note: 模型
range: scrum
prefix: ""
postfix: ""
- field: type
note: 类型
range: project
prefix: ""
postfix: ""
- field: budget
note: 预算
range: '100000'
prefix: ""
postfix: ""
- field: budgetUnit
note: 预算单位
range: CNY
prefix: ""
postfix: ""
- field: attribute
note: 属性
range: ""
prefix: ""
postfix: ""
- field: percent
note: 百分比
range: '0'
prefix: ""
postfix: ""
- field: grade
note: 等级
range: '1'
prefix: ""
postfix: ""
- field: name
note: 项目名称
range: 'Test Execution 101'
prefix: ""
postfix: ""
- field: code
note: 项目代号
range: ""
prefix: ""
postfix: ""
- field: hasProduct
note: 是否关联产品
range: '1'
prefix: ""
postfix: ""
- field: begin
note: 开始日期
range: '`(-1M):1D`'
prefix: ""
postfix: ""
- field: end
note: 结束日期
range: '`(+1M):1D`'
prefix: ""
postfix: ""
- field: realBegan
note: 实际开始
range: '0000-00-00'
prefix: ""
postfix: ""
- field: realEnd
note: 实际结束
range: '0000-00-00'
prefix: ""
postfix: ""
- field: status
note: 状态
range: doing
prefix: ""
postfix: ""
- field: subStatus
note: 子状态
range: ""
prefix: ""
postfix: ""
- field: pri
note: 优先级
range: '1'
prefix: ""
postfix: ""
- field: desc
note: 项目描述
range: 'Test execution for refreshERURCards'
prefix: ""
postfix: ""
- field: version
note: 版本
range: '1'
prefix: ""
postfix: ""
- field: parentVersion
note: 父版本
range: '1'
prefix: ""
postfix: ""
- field: planDuration
note: 计划工期
range: '0'
prefix: ""
postfix: ""
- field: realDuration
note: 实际工期
range: '0'
prefix: ""
postfix: ""
- field: openedBy
note: 由谁创建
range: admin
prefix: ""
postfix: ""
- field: openedDate
note: 创建时间
range: '`(-1M):1D`'
prefix: ""
postfix: ""
- field: openedVersion
note: 创建版本
range: ""
prefix: ""
postfix: ""
- field: lastEditedBy
note: 最后编辑者
range: ""
prefix: ""
postfix: ""
- field: lastEditedDate
note: 最后编辑时间
range: '0000-00-00 00:00:00'
prefix: ""
postfix: ""
- field: closedBy
note: 由谁关闭
range: ""
prefix: ""
postfix: ""
- field: closedDate
note: 关闭时间
range: '0000-00-00 00:00:00'
prefix: ""
postfix: ""
- field: canceledBy
note: 由谁取消
range: ""
prefix: ""
postfix: ""
- field: canceledDate
note: 取消时间
range: '0000-00-00 00:00:00'
prefix: ""
postfix: ""
- field: suspendedDate
note: 暂停时间
range: '0000-00-00'
prefix: ""
postfix: ""
- field: PO
note: 产品负责人
range: admin
prefix: ""
postfix: ""
- field: PM
note: 项目经理
range: admin
prefix: ""
postfix: ""
- field: QD
note: 测试负责人
range: admin
prefix: ""
postfix: ""
- field: RD
note: 发布负责人
range: admin
prefix: ""
postfix: ""
- field: team
note: 团队
range: ""
prefix: ""
postfix: ""
- field: acl
note: 访问控制
range: open
prefix: ""
postfix: ""
- field: whitelist
note: 白名单
range: ""
prefix: ""
postfix: ""
- field: order
note: 排序
range: '0'
prefix: ""
postfix: ""
- field: vision
note: 视图
range: rnd
prefix: ""
postfix: ""
- field: displayCards
note: 显示卡片
range: '0'
prefix: ""
postfix: ""
- field: fluidBoard
note: 流式看板
range: '0'
prefix: ""
postfix: ""
- field: deleted
note: 已删除
range: '0'
prefix: ""
postfix: ""
@@ -0,0 +1,36 @@
---
title: ProjectStory关联数据用于测试refreshERURCards方法
author: Claude
version: 1.0
fields:
- field: project
note: 项目ID
range: '101'
prefix: ""
postfix: ""
- field: product
note: 产品ID
range: '1'
prefix: ""
postfix: ""
- field: branch
note: 分支
range: '0'
prefix: ""
postfix: ""
- field: story
note: 需求ID
range: 1-15
prefix: ""
postfix: ""
- field: version
note: 版本
range: '1'
prefix: ""
postfix: ""
- field: order
note: 排序
range: 1-15
prefix: ""
postfix: ""
@@ -0,0 +1,98 @@
---
title: Story数据用于测试refreshERURCards方法
author: Claude
version: 1.0
fields:
- field: id
note: 需求ID
range: 1-15
prefix: ""
postfix: ""
loop: 0
format: ""
- field: vision
note: 视图
range: rnd
prefix: ""
postfix: ""
- field: parent
note: 父需求
range: '0{10},1{3},1{2}'
prefix: ""
postfix: ""
- field: isParent
note: 是否父需求
range: '1,0{9},1{3},0{2}'
prefix: ""
postfix: ""
- field: root
note: 根需求
range: '1-15'
prefix: ""
postfix: ""
- field: product
note: 产品ID
range: '1'
prefix: ""
postfix: ""
- field: branch
note: 分支
range: '0'
prefix: ""
postfix: ""
- field: module
note: 模块
range: '0'
prefix: ""
postfix: ""
- field: title
note: 需求标题
range: '["Epic Story 1", "UR Story 1", "UR Story 2", "Story 1", "Story 2", "Story 3", "Story 4", "Story 5", "Story 6", "Story 7", "Parent Story 1", "Child Story 1", "Child Story 2", "Child Story 3", "Story 15"]'
prefix: ""
postfix: ""
- field: type
note: 需求类型
range: '["epic", "requirement", "requirement", "story", "story", "story", "story", "story", "story", "story", "story", "story", "story", "story", "story"]'
prefix: ""
postfix: ""
- field: pri
note: 优先级
range: 1-4
prefix: ""
postfix: ""
- field: estimate
note: 预计工时
range: 1-10
prefix: ""
postfix: ""
- field: status
note: 状态
range: 'active{14},closed'
prefix: ""
postfix: ""
- field: stage
note: 阶段
range: '["wait", "planned", "projected", "developing", "delivering", "delivered", "closed", "wait", "planned", "projected", "developing", "delivering", "delivered", "closed", "wait"]'
prefix: ""
postfix: ""
- field: openedBy
note: 由谁创建
range: admin
prefix: ""
postfix: ""
- field: openedDate
note: 创建时间
range: '`(-1M)-(-1w):1D`'
prefix: ""
postfix: ""
- field: version
note: 版本
range: '1'
prefix: ""
postfix: ""
- field: deleted
note: 已删除
range: '0'
prefix: ""
postfix: ""
+2 -1
View File
@@ -4,6 +4,7 @@
/**
title=测试 userModel->checkAccountChange();
timeout=0
cid=0
- 新用户忙和旧用户名相同,返回 false。属性result @0
@@ -88,4 +89,4 @@ r($views) && p('0:account') && e('user1'); // 第 1 条记录的用户
$admins = $tester->dao->select('admins')->from(TABLE_COMPANY)->where('id')->eq(1)->fetch('admins');
r($admins) && p() && e(',user1,'); // 数据库中超级管理员是 user1。
r($app->company->admins) && p() && e(',user1,'); // $app 对象中超级管理员是 user1。
r($app->company->admins) && p() && e(',user1,'); // $app 对象中超级管理员是 user1。