* [misc] Enhance unit tests for storyModel::getDefaultShowGrades() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
story,requirement,
|
||||
story,requirement,epic,feature,
|
||||
0
|
||||
0
|
||||
1,2,3,
|
||||
,valid_value,0,,
|
||||
level1_item1,level1_item2,level2_item1,level2_item2,level2_item3,level3_item1,
|
||||
@@ -7,27 +7,23 @@ title=测试 storyModel::getDefaultShowGrades();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 步骤3:边界值测试空数组 @
|
||||
- 执行storyTest模块的getDefaultShowGradesTest方法,参数是array @
|
||||
|
||||
*/
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/story.unittest.class.php';
|
||||
|
||||
// 2. 用户登录(选择合适角色)
|
||||
su('admin');
|
||||
|
||||
// 3. 创建测试实例(变量名与模块名一致)
|
||||
$storyTest = new storyTest();
|
||||
|
||||
// 4. 强制要求:必须包含至少5个测试步骤
|
||||
r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('items' => array(
|
||||
array('value' => 'story'),
|
||||
array('value' => 'requirement')
|
||||
))
|
||||
))) && p() && e('story,requirement,'); // 步骤1:正常情况测试单级菜单
|
||||
))) && p() && e('story,requirement,');
|
||||
|
||||
r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('items' => array(
|
||||
@@ -38,13 +34,13 @@ r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('value' => 'epic'),
|
||||
array('value' => 'feature')
|
||||
))
|
||||
))) && p() && e('story,requirement,epic,feature,'); // 步骤2:正常情况测试多级菜单
|
||||
))) && p() && e('story,requirement,epic,feature,');
|
||||
|
||||
r($storyTest->getDefaultShowGradesTest(array())) && p() && e(''); // 步骤3:边界值测试空数组
|
||||
r($storyTest->getDefaultShowGradesTest(array())) && p() && e('');
|
||||
|
||||
r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('items' => array())
|
||||
))) && p() && e(''); // 步骤4:边界值测试空items数组
|
||||
))) && p() && e('');
|
||||
|
||||
r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('items' => array(
|
||||
@@ -52,7 +48,7 @@ r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('value' => 2),
|
||||
array('value' => 3)
|
||||
))
|
||||
))) && p() && e('1,2,3,'); // 步骤5:测试包含数字值的菜单
|
||||
))) && p() && e('1,2,3,');
|
||||
|
||||
r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('items' => array(
|
||||
@@ -61,7 +57,7 @@ r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('value' => '0'),
|
||||
array('value' => null)
|
||||
))
|
||||
))) && p() && e(',valid_value,0,,'); // 步骤6:测试包含空字符串和null value的菜单
|
||||
))) && p() && e(',valid_value,0,,');
|
||||
|
||||
r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('items' => array(
|
||||
@@ -76,4 +72,4 @@ r($storyTest->getDefaultShowGradesTest(array(
|
||||
array('items' => array(
|
||||
array('value' => 'level3_item1')
|
||||
))
|
||||
))) && p() && e('level1_item1,level1_item2,level2_item1,level2_item2,level2_item3,level3_item1,'); // 步骤7:测试复杂多级嵌套菜单
|
||||
))) && p() && e('level1_item1,level1_item2,level2_item1,level2_item2,level2_item3,level3_item1,');
|
||||
Reference in New Issue
Block a user