* [misc] Enhance unit tests for biModel::buildQueryResultTableColumns() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,43 +1,70 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 biModel::buildQueryResultTableColumns();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 步骤3:空数组输入边界值测试 @0
|
||||
|
||||
*/
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/bi.unittest.class.php';
|
||||
|
||||
// 2. 用户登录(选择合适角色)
|
||||
su('admin');
|
||||
|
||||
// 3. 创建测试实例(变量名与模块名一致)
|
||||
/**
|
||||
|
||||
title=测试biModel->buildQueryResultTableColumns();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行biTest模块的buildQueryResultTableColumnsTest方法,参数是array @0
|
||||
|
||||
*/
|
||||
|
||||
$biTest = new biTest();
|
||||
|
||||
// 4. 强制要求:必须包含至少5个测试步骤
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'id' => array('zh-cn' => '编号', 'en' => 'ID', 'type' => 'int'),
|
||||
'name' => array('zh-cn' => '名称', 'en' => 'Name', 'type' => 'string')
|
||||
))) && p('0:name,0:title,0:sortType;1:name,1:title,1:sortType') && e('id,编号,0;name,名称,0'); // 步骤1:正常多语言字段配置转换测试
|
||||
))) && p('0:name') && e('id');
|
||||
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'id' => array('zh-cn' => '编号', 'en' => 'ID', 'type' => 'int'),
|
||||
'name' => array('zh-cn' => '名称', 'en' => 'Name', 'type' => 'string')
|
||||
))) && p('0:title') && e('编号');
|
||||
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'id' => array('zh-cn' => '编号', 'en' => 'ID', 'type' => 'int'),
|
||||
'name' => array('zh-cn' => '名称', 'en' => 'Name', 'type' => 'string')
|
||||
))) && p('1:name') && e('name');
|
||||
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'id' => array('zh-cn' => '编号', 'en' => 'ID', 'type' => 'int'),
|
||||
'name' => array('zh-cn' => '名称', 'en' => 'Name', 'type' => 'string')
|
||||
))) && p('1:title') && e('名称');
|
||||
|
||||
r(count($biTest->buildQueryResultTableColumnsTest(array()))) && p() && e('0');
|
||||
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'code' => array('type' => 'string'),
|
||||
'status' => array('type' => 'int')
|
||||
))) && p('0:name,0:title,0:sortType;1:name,1:title,1:sortType') && e('code,code,0;status,status,0'); // 步骤2:缺少多语言配置的字段处理测试
|
||||
|
||||
r($biTest->buildQueryResultTableColumnsTest(array())) && p() && e('0'); // 步骤3:空数组输入边界值测试
|
||||
))) && p('0:name') && e('code');
|
||||
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'user_id' => array('zh-cn' => '用户ID', 'type' => 'int')
|
||||
))) && p('0:name,0:title,0:sortType') && e('user_id,用户ID,0'); // 步骤4:单个字段配置功能测试
|
||||
'code' => array('type' => 'string'),
|
||||
'status' => array('type' => 'int')
|
||||
))) && p('0:title') && e('code');
|
||||
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'field_name' => array('zh-cn' => '字段名@#$%^&*()', 'type' => 'string')
|
||||
))) && p('0:name,0:title,0:sortType') && e('field_name,字段名@#$%^&*(),0'); // 步骤5:特殊字符和复杂标题处理测试
|
||||
'code' => array('type' => 'string'),
|
||||
'status' => array('type' => 'int')
|
||||
))) && p('1:name') && e('status');
|
||||
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'code' => array('type' => 'string'),
|
||||
'status' => array('type' => 'int')
|
||||
))) && p('1:title') && e('status');
|
||||
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'special_field' => array('zh-cn' => '特殊字符@#$%^&*()', 'type' => 'string')
|
||||
))) && p('0:title') && e('特殊字符@#$%^&*()');
|
||||
|
||||
global $app;
|
||||
$app->setClientLang('en');
|
||||
r($biTest->buildQueryResultTableColumnsTest(array(
|
||||
'id' => array('zh-cn' => '编号', 'en' => 'ID', 'type' => 'int')
|
||||
))) && p('0:title') && e('ID');
|
||||
Reference in New Issue
Block a user