* [misc] Enhance unit tests for storyModel::getEstimateRounds() 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:38 +08:00
co-authored by Claude
parent 70880977a1
commit e0d4b2aad9
2 changed files with 51 additions and 8 deletions
@@ -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;
}
}
+36 -8
View File
@@ -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 轮估算');