+ [misc] Add unit tests for groupZen::getNavGroup() method

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-09-15 15:09:56 +08:00
co-authored by Claude
parent 50fc661b26
commit e4ad1f4d88
2 changed files with 50 additions and 0 deletions
@@ -193,4 +193,21 @@ class groupZenTest
return $result;
}
/**
* 测试getNavGroup方法。
* Test getNavGroup method.
*
* @access public
* @return array
*/
public function getNavGroupTest()
{
$method = $this->groupZenTest->getMethod('getNavGroup');
$groupInstance = $this->groupZenTest->newInstance();
$result = $method->invoke($groupInstance);
return $result;
}
}
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env php
<?php
/**
title=测试 groupZen::getNavGroup();
timeout=0
cid=0
- 步骤1:正常获取NavGroup数据,验证返回正确数量的分组 @13
- 步骤2:验证admin分组包含group模块第admin条的group属性 @group
- 步骤3:验证product分组包含story模块第product条的story属性 @story
- 步骤4:验证qa分组中testcase映射为case第qa条的case属性 @case
- 步骤5:验证execution分组包含task模块第execution条的task属性 @task
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/groupzen.unittest.class.php';
// 2. 用户登录(选择合适角色)
su('admin');
// 3. 创建测试实例(变量名与模块名一致)
$groupTest = new groupZenTest();
// 4. 强制要求:必须包含至少5个测试步骤
r(count($groupTest->getNavGroupTest())) && p() && e(13); // 步骤1:正常获取NavGroup数据,验证返回正确数量的分组
r($groupTest->getNavGroupTest()) && p('admin:group') && e('group'); // 步骤2:验证admin分组包含group模块
r($groupTest->getNavGroupTest()) && p('product:story') && e('story'); // 步骤3:验证product分组包含story模块
r($groupTest->getNavGroupTest()) && p('qa:case') && e('case'); // 步骤4:验证qa分组中testcase映射为case
r($groupTest->getNavGroupTest()) && p('execution:task') && e('task'); // 步骤5:验证execution分组包含task模块