diff --git a/module/story/test/lib/story.unittest.class.php b/module/story/test/lib/story.unittest.class.php index d27b465f13..bc864026fc 100755 --- a/module/story/test/lib/story.unittest.class.php +++ b/module/story/test/lib/story.unittest.class.php @@ -4006,4 +4006,19 @@ class storyTest return $result; } + + /** + * Test getEstimateRounds method. + * + * @param int $storyID + * @access public + * @return array + */ + public function getEstimateRoundsTest(int $storyID): array + { + $result = $this->objectModel->getEstimateRounds($storyID); + if(dao::isError()) return dao::getError(); + + return $result; + } } diff --git a/module/story/test/model/getestimaterounds.php b/module/story/test/model/getestimaterounds.php index 930c9b4523..5e48b997c5 100755 --- a/module/story/test/model/getestimaterounds.php +++ b/module/story/test/model/getestimaterounds.php @@ -3,20 +3,48 @@ /** -title=测试 storyModel->getEstimateRounds(); +title=测试 storyModel::getEstimateRounds(); +timeout=0 cid=0 -- 执行story模块的getEstimateRounds方法 @0 -- 执行story模块的getEstimateRounds方法,参数是2 属性1 @第 1 轮估算 +- 执行storyTest模块的getEstimateRoundsTest方法,参数是999 @0 +- 执行storyTest模块的getEstimateRoundsTest方法,参数是2 属性1 @第 1 轮估算 +- 执行storyTest模块的getEstimateRoundsTest方法,参数是1 + - 属性1 @第 1 轮估算 + - 属性2 @第 2 轮估算 + - 属性3 @第 3 轮估算 +- 执行storyTest模块的getEstimateRoundsTest方法,参数是-1 @0 +- 执行storyTest模块的getEstimateRoundsTest方法 @0 +- 执行storyTest模块的getEstimateRoundsTest方法,参数是4 @0 +- 执行storyTest模块的getEstimateRoundsTest方法,参数是3 + - 属性1 @第 1 轮估算 + - 属性2 @第 2 轮估算 + - 属性3 @第 3 轮估算 + - 属性4 @第 4 轮估算 + - 属性5 @第 5 轮估算 */ + include dirname(__FILE__, 5) . '/test/lib/init.php'; include dirname(__FILE__, 2) . '/lib/story.unittest.class.php'; + +$storyEstimate = zenData('storyestimate'); +$storyEstimate->story->range('1{3},2{1},3{5}'); +$storyEstimate->round->range('1,2,3,1,1,2,3,4,5'); +$storyEstimate->estimate->range('estimate1,estimate2,estimate3'); +$storyEstimate->average->range('1.5,2.5,3.5'); +$storyEstimate->openedBy->range('admin'); +$storyEstimate->openedDate->range('`2023-01-01 10:00:00`'); +$storyEstimate->gen(9); + su('admin'); -zenData('storyestimate')->gen(10); +$storyTest = new storyTest(); -global $tester; -$tester->loadModel('story'); -r($tester->story->getEstimateRounds(0)) && p() && e('0'); -r($tester->story->getEstimateRounds(2)) && p('1') && e('第 1 轮估算'); +r($storyTest->getEstimateRoundsTest(999)) && p() && e('0'); +r($storyTest->getEstimateRoundsTest(2)) && p('1') && e('第 1 轮估算'); +r($storyTest->getEstimateRoundsTest(1)) && p('1,2,3') && e('第 1 轮估算,第 2 轮估算,第 3 轮估算'); +r($storyTest->getEstimateRoundsTest(-1)) && p() && e('0'); +r($storyTest->getEstimateRoundsTest(0)) && p() && e('0'); +r($storyTest->getEstimateRoundsTest(4)) && p() && e('0'); +r($storyTest->getEstimateRoundsTest(3)) && p('1,2,3,4,5') && e('第 1 轮估算,第 2 轮估算,第 3 轮估算,第 4 轮估算,第 5 轮估算'); \ No newline at end of file