* [misc] Enhance unit tests for storyModel::batchGetStoryStage() method

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-09-25 09:16:37 +08:00
co-authored by Claude
parent e39993d7a8
commit fe35e59bf5
3 changed files with 55 additions and 13 deletions
@@ -3801,4 +3801,19 @@ class storyTest
return $options;
}
/**
* Test batchGetStoryStage method.
*
* @param array $storyIdList
* @access public
* @return array
*/
public function batchGetStoryStageTest(array $storyIdList): array
{
$result = $this->objectModel->batchGetStoryStage($storyIdList);
if(dao::isError()) return dao::getError();
return $result;
}
}
+21 -13
View File
@@ -3,26 +3,34 @@
/**
title=测试 storyModel->batchGetStoryStage();
title=测试 storyModel::batchGetStoryStage();
timeout=0
cid=0
- 执行$stage[1]第0条的stage属性 @wait
- 执行$stage[2]第1条的stage属性 @planned
- 执行$stage[3]第2条的stage属性 @projected
- 执行storyTest模块的batchGetStoryStageTest方法,参数是array 第100条的0:stage属性 @wait
- 执行storyTest模块的batchGetStoryStageTest方法,参数是array 第101条的0:stage属性 @planned
- 执行storyTest模块的batchGetStoryStageTest方法,参数是array @~~
- 执行storyTest模块的batchGetStoryStageTest方法,参数是array @~~
- 执行storyTest模块的batchGetStoryStageTest方法,参数是array 第103条的0:stage属性 @developing
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/story.unittest.class.php';
su('admin');
$storystage = zenData('storystage');
$storystage->branch->range('0-100');
$storystage->gen(20);
$storystage->story->range('100-104');
$storystage->branch->range('0');
$storystage->stage->range('wait,planned,projected,developing,testing');
$storystage->stagedBy->range('admin');
$storystage->gen(5);
global $tester;
$tester->loadModel('story');
su('admin');
$stage = $tester->story->batchGetStoryStage(array(1,2,3));
r($stage[1]) && p('0:stage') && e('wait');
r($stage[2]) && p('1:stage') && e('planned');
r($stage[3]) && p('2:stage') && e('projected');
$storyTest = new storyTest();
r($storyTest->batchGetStoryStageTest(array(100,101,102))) && p('100:0:stage') && e('wait');
r($storyTest->batchGetStoryStageTest(array(101))) && p('101:0:stage') && e('planned');
r($storyTest->batchGetStoryStageTest(array(999))) && p() && e('~~');
r($storyTest->batchGetStoryStageTest(array())) && p() && e('~~');
r($storyTest->batchGetStoryStageTest(array(103))) && p('103:0:stage') && e('developing');
@@ -0,0 +1,19 @@
---
title: 需求阶段测试数据
desc: 用于batchGetStoryStage方法测试
author: Claude
version: 1.0
fields:
- field: story
note: 需求ID
range: 1,2,3,4,5
- field: branch
note: 分支ID
range: 0{3},1{1},2{1}
- field: stage
note: 阶段状态
range: wait,planned,projected,developing,testing
- field: stagedBy
note: 阶段设置者
range: admin{5}