diff --git a/module/story/test/lib/story.unittest.class.php b/module/story/test/lib/story.unittest.class.php index 357333779f..f57d2e405d 100755 --- a/module/story/test/lib/story.unittest.class.php +++ b/module/story/test/lib/story.unittest.class.php @@ -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; + } } diff --git a/module/story/test/model/batchgetstorystage.php b/module/story/test/model/batchgetstorystage.php index 799146da65..ba6015eee8 100755 --- a/module/story/test/model/batchgetstorystage.php +++ b/module/story/test/model/batchgetstorystage.php @@ -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'); \ No newline at end of file diff --git a/module/story/test/model/yaml/storystage_batchgetstorystage.yaml b/module/story/test/model/yaml/storystage_batchgetstorystage.yaml new file mode 100644 index 0000000000..979c3433bd --- /dev/null +++ b/module/story/test/model/yaml/storystage_batchgetstorystage.yaml @@ -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} \ No newline at end of file