+ [misc] Add unit tests for biModel::getCorrectGroup() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 biModel::getCorrectGroup();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 测试步骤1: 测试单个有效的chart模块ID @1
|
||||
- 测试步骤2: 测试单个有效的pivot模块ID @13
|
||||
- 测试步骤3: 测试不存在的模块ID @0
|
||||
- 测试步骤4: 测试多个有效模块ID用逗号分隔 @1,2
|
||||
|
||||
- 测试步骤5: 测试包含无效ID和空ID的混合列表 @1,2
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/bi.unittest.class.php';
|
||||
|
||||
$module = zenData('module');
|
||||
$module->id->range('1-20');
|
||||
$module->root->range('1');
|
||||
$module->name->range('产品,项目,测试,组织');
|
||||
$module->parent->range('0');
|
||||
$module->path->range(',1,,2,,3,,4,');
|
||||
$module->grade->range('1');
|
||||
$module->order->range('1-20');
|
||||
$module->type->range('chart{10},pivot{10}');
|
||||
$module->branch->range('0');
|
||||
$module->from->range('0');
|
||||
$module->owner->range('``');
|
||||
$module->collector->range('``');
|
||||
$module->short->range('``');
|
||||
$module->deleted->range('0');
|
||||
$module->gen(20);
|
||||
|
||||
su('admin');
|
||||
|
||||
$biTest = new biTest();
|
||||
|
||||
r($biTest->getCorrectGroupTest('32', 'chart')) && p() && e('1'); // 测试步骤1: 测试单个有效的chart模块ID
|
||||
r($biTest->getCorrectGroupTest('59', 'pivot')) && p() && e('13'); // 测试步骤2: 测试单个有效的pivot模块ID
|
||||
r($biTest->getCorrectGroupTest('999', 'chart')) && p() && e('0'); // 测试步骤3: 测试不存在的模块ID
|
||||
r($biTest->getCorrectGroupTest('32,33', 'chart')) && p() && e('1,2'); // 测试步骤4: 测试多个有效模块ID用逗号分隔
|
||||
r($biTest->getCorrectGroupTest('32,999,33', 'chart')) && p() && e('1,2'); // 测试步骤5: 测试包含无效ID和空ID的混合列表
|
||||
@@ -0,0 +1,60 @@
|
||||
---
|
||||
title: zt_module 表测试数据
|
||||
desc: 用于测试 getCorrectGroup 方法的模块数据
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
note: 模块ID
|
||||
range: 1-20
|
||||
|
||||
- field: root
|
||||
note: 根模块ID
|
||||
range: 1{5},2{5},3{5}
|
||||
|
||||
- field: branch
|
||||
note: 分支
|
||||
range: 0
|
||||
|
||||
- field: name
|
||||
note: 模块名称
|
||||
range: '产品{5},项目{5},测试{5},组织{5}'
|
||||
|
||||
- field: parent
|
||||
note: 父模块ID
|
||||
range: 0
|
||||
|
||||
- field: path
|
||||
note: 路径
|
||||
range: ',1,,2,,3,,4,,5,,6,,7,,8,,9,,10,,11,,12,,13,,14,,15,'
|
||||
|
||||
- field: grade
|
||||
note: 等级
|
||||
range: 1{10},2{10}
|
||||
|
||||
- field: order
|
||||
note: 排序
|
||||
range: 1-20
|
||||
|
||||
- field: type
|
||||
note: 类型
|
||||
range: 'chart{10},pivot{10}'
|
||||
|
||||
- field: from
|
||||
note: 来源
|
||||
range: 0
|
||||
|
||||
- field: owner
|
||||
note: 所有者
|
||||
range: ''
|
||||
|
||||
- field: collector
|
||||
note: 收藏者
|
||||
range: ''
|
||||
|
||||
- field: short
|
||||
note: 简称
|
||||
range: ''
|
||||
|
||||
- field: deleted
|
||||
note: 是否删除
|
||||
range: '0'
|
||||
Reference in New Issue
Block a user