+ [misc] Add unit tests for productZen::getExportFields() method

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-11-12 08:31:02 +08:00
co-authored by Claude
parent 64df9499f3
commit 97667fcacd
2 changed files with 42 additions and 0 deletions
+13
View File
@@ -478,6 +478,19 @@ class productZenTest extends baseTest
return $result;
}
/**
* Test getExportFields method.
*
* @access public
* @return array
*/
public function getExportFieldsTest()
{
$result = $this->invokeArgs('getExportFields', array());
if(dao::isError()) return dao::getError();
return $result;
}
/**
* Test getExportData method.
*
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
/**
title=测试 productZen::getExportFields();
timeout=0
cid=0
- 步骤1:测试返回的字段数组包含name字段且值为产品名称属性name @产品名称
- 步骤2:测试返回的字段数组包含productLine字段且值为所属产品线属性productLine @所属产品线
- 步骤3:测试返回的字段数组包含PO字段且值为负责人属性PO @负责人
- 步骤4:测试返回的字段包含draftStories字段且包含草稿关键词属性draftStories @ - 草稿
- 步骤5:测试返回的字段数据类型是数组 @array
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/zen.class.php';
su('admin');
$productTest = new productZenTest();
r($productTest->getExportFieldsTest()) && p('name') && e('产品名称'); // 步骤1:测试返回的字段数组包含name字段且值为产品名称
r($productTest->getExportFieldsTest()) && p('productLine') && e('所属产品线'); // 步骤2:测试返回的字段数组包含productLine字段且值为所属产品线
r($productTest->getExportFieldsTest()) && p('PO') && e('负责人'); // 步骤3:测试返回的字段数组包含PO字段且值为负责人
r($productTest->getExportFieldsTest()) && p('draftStories') && e(' - 草稿'); // 步骤4:测试返回的字段包含draftStories字段且包含草稿关键词
r(gettype($productTest->getExportFieldsTest())) && p() && e('array'); // 步骤5:测试返回的字段数据类型是数组