+ [misc] Add unit tests for pivotModel::processDTableCols() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1042,4 +1042,19 @@ class pivotTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test processDTableCols method.
|
||||
*
|
||||
* @param array $cols
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function processDTableColsTest(array $cols)
|
||||
{
|
||||
$result = $this->objectModel->processDTableCols($cols);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 pivotModel::processDTableCols();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行$result1) && is_array($result1 @1
|
||||
- 执行$result2) && is_array($result2 @1
|
||||
- 执行$result3 @1
|
||||
- 执行$result4) && is_array($result4 @1
|
||||
- 执行$result5) && is_array($result5 @1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/pivot.unittest.class.php';
|
||||
|
||||
$pivotTest = new pivotTest();
|
||||
|
||||
// 测试1:多列输入,验证返回数组不为空
|
||||
$result1 = $pivotTest->processDTableColsTest(array('id' => array('title' => 'ID'), 'name' => array('title' => '名称'), 'status' => array('title' => '状态')));
|
||||
r(!empty($result1) && is_array($result1)) && p() && e('1');
|
||||
|
||||
// 测试2:单列输入,验证返回数组不为空
|
||||
$result2 = $pivotTest->processDTableColsTest(array('id' => array('title' => 'ID')));
|
||||
r(!empty($result2) && is_array($result2)) && p() && e('1');
|
||||
|
||||
// 测试3:空输入,验证返回数组
|
||||
$result3 = $pivotTest->processDTableColsTest(array());
|
||||
r(is_array($result3)) && p() && e('1');
|
||||
|
||||
// 测试4:特殊字符测试
|
||||
$result4 = $pivotTest->processDTableColsTest(array('field_@#' => array('title' => 'Title@#$')));
|
||||
r(!empty($result4) && is_array($result4)) && p() && e('1');
|
||||
|
||||
// 测试5:中文标题测试
|
||||
$result5 = $pivotTest->processDTableColsTest(array('项目' => array('title' => '项目管理')));
|
||||
r(!empty($result5) && is_array($result5)) && p() && e('1');
|
||||
Reference in New Issue
Block a user