+ [misc] Add unit tests for convertTao::updateSubTask() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3930,4 +3930,24 @@ class convertTest
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test updateSubTask method.
|
||||
*
|
||||
* @param array $taskLink
|
||||
* @param array $issueList
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function updateSubTaskTest($taskLink = array(), $issueList = array())
|
||||
{
|
||||
$reflection = new ReflectionClass($this->objectTao);
|
||||
$method = $reflection->getMethod('updateSubTask');
|
||||
$method->setAccessible(true);
|
||||
|
||||
$result = $method->invoke($this->objectTao, $taskLink, $issueList);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 convertTao::updateSubTask();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 步骤1:正常父子任务关系 @1
|
||||
- 步骤2:空任务链接数组 @1
|
||||
- 步骤3:issue列表中缺少父任务数据 @1
|
||||
- 步骤4:issue类型非ztask @1
|
||||
- 步骤5:复杂多层父子任务关系 @1
|
||||
|
||||
*/
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/convert.unittest.class.php';
|
||||
|
||||
// 2. zendata数据准备(根据需要配置)
|
||||
$table = zenData('task');
|
||||
$table->id->range('1-10');
|
||||
$table->name->range('父任务1,子任务1,子任务2,父任务2,子任务3,任务6,任务7,任务8,任务9,任务10');
|
||||
$table->parent->range('0{10}');
|
||||
$table->isParent->range('0{10}');
|
||||
$table->path->range('1{10}');
|
||||
$table->execution->range('1-5,1-5');
|
||||
$table->status->range('wait{5},doing{3},done{2}');
|
||||
$table->deleted->range('0{10}');
|
||||
$table->gen(10);
|
||||
|
||||
// 3. 用户登录(选择合适角色)
|
||||
su('admin');
|
||||
|
||||
// 4. 创建测试实例(变量名与模块名一致)
|
||||
$convertTest = new convertTest();
|
||||
|
||||
// 5. 🔴 强制要求:必须包含至少5个测试步骤
|
||||
r($convertTest->updateSubTaskTest(array('issue1' => array('issue2', 'issue3')), array('issue1' => array('BType' => 'ztask', 'BID' => '1'), 'issue2' => array('BType' => 'ztask', 'BID' => '2'), 'issue3' => array('BType' => 'ztask', 'BID' => '3')))) && p() && e(1); // 步骤1:正常父子任务关系
|
||||
r($convertTest->updateSubTaskTest(array(), array())) && p() && e(1); // 步骤2:空任务链接数组
|
||||
r($convertTest->updateSubTaskTest(array('issue1' => array('issue2')), array('issue2' => array('BType' => 'ztask', 'BID' => '2')))) && p() && e(1); // 步骤3:issue列表中缺少父任务数据
|
||||
r($convertTest->updateSubTaskTest(array('issue1' => array('issue2')), array('issue1' => array('BType' => 'story', 'BID' => '1'), 'issue2' => array('BType' => 'ztask', 'BID' => '2')))) && p() && e(1); // 步骤4:issue类型非ztask
|
||||
r($convertTest->updateSubTaskTest(array('issue1' => array('issue2', 'issue3'), 'issue4' => array('issue5')), array('issue1' => array('BType' => 'ztask', 'BID' => '4'), 'issue2' => array('BType' => 'ztask', 'BID' => '5'), 'issue3' => array('BType' => 'ztask', 'BID' => '6'), 'issue4' => array('BType' => 'ztask', 'BID' => '7'), 'issue5' => array('BType' => 'ztask', 'BID' => '8')))) && p() && e(1); // 步骤5:复杂多层父子任务关系
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
title: 任务表数据定义 - updateSubTask测试用
|
||||
desc: 为测试convertTao::updateSubTask()方法生成任务测试数据
|
||||
author: Claude
|
||||
version: 1.0
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
note: 任务ID
|
||||
range: 1-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: project
|
||||
note: 项目ID
|
||||
range: 1-3
|
||||
format: ""
|
||||
- field: parent
|
||||
note: 父任务ID,默认为0表示顶级任务
|
||||
range: 0{10}
|
||||
format: ""
|
||||
- field: isParent
|
||||
note: 是否为父任务,0否1是
|
||||
range: 0{10}
|
||||
format: ""
|
||||
- field: path
|
||||
note: 任务路径
|
||||
range: ',1,,2,,3,,4,,5,,6,,7,,8,,9,,10,'
|
||||
format: ""
|
||||
- field: execution
|
||||
note: 执行ID
|
||||
range: 1-5,1-5
|
||||
format: ""
|
||||
- field: module
|
||||
note: 模块ID
|
||||
range: 0{10}
|
||||
format: ""
|
||||
- field: name
|
||||
note: 任务名称
|
||||
range: 父任务1,子任务1,子任务2,父任务2,子任务3,任务6,任务7,任务8,任务9,任务10
|
||||
format: ""
|
||||
- field: type
|
||||
note: 任务类型
|
||||
range: devel{6},test{2},design{2}
|
||||
format: ""
|
||||
- field: status
|
||||
note: 任务状态
|
||||
range: wait{5},doing{3},done{2}
|
||||
format: ""
|
||||
- field: assignedTo
|
||||
note: 指派给
|
||||
range: admin{3},user1{3},user2{2},user3{2}
|
||||
format: ""
|
||||
- field: estimate
|
||||
note: 预计工时
|
||||
range: 1-8
|
||||
format: ""
|
||||
- field: consumed
|
||||
note: 已消耗工时
|
||||
range: 0-5
|
||||
format: ""
|
||||
- field: left
|
||||
note: 剩余工时
|
||||
range: 0-8
|
||||
format: ""
|
||||
- field: deadline
|
||||
note: 截止日期
|
||||
range: 2024-01-01,2024-02-01,2024-03-01
|
||||
format: ""
|
||||
- field: pri
|
||||
note: 优先级
|
||||
range: 1-4
|
||||
format: ""
|
||||
- field: desc
|
||||
note: 任务描述
|
||||
range: 测试任务描述1,测试任务描述2,测试任务描述3
|
||||
format: ""
|
||||
- field: version
|
||||
note: 版本
|
||||
range: 1{10}
|
||||
format: ""
|
||||
- field: openedBy
|
||||
note: 创建者
|
||||
range: admin{10}
|
||||
format: ""
|
||||
- field: openedDate
|
||||
note: 创建时间
|
||||
range: 2024-01-01 10:00:00{10}
|
||||
format: ""
|
||||
- field: deleted
|
||||
note: 是否删除
|
||||
range: 0{10}
|
||||
format: ""
|
||||
Reference in New Issue
Block a user