* [unittest] add unittest for getBuildinRawContent method.

This commit is contained in:
tianshujie
2025-09-10 10:10:53 +08:00
parent cbc5a5c72e
commit 7d4df9105e
2 changed files with 42 additions and 0 deletions
@@ -419,4 +419,17 @@ class weeklyTest
if(dao::isError()) return dao::getError();
return $this->objectModel->dao->select('*')->from(TABLE_DOC)->fetch();
}
/**
* 获取内置项目周报模板内容。
* Get builtin project weekly report template content.
*
* @access public
* @return array
*/
public function getBuildinRawContentTest(): array
{
$content = $this->objectModel->getBuildinRawContent(array());
return json_decode($content, true);
}
}
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
/**
title=测试 weeklyModel->getBuildinRawContent();
timeout=0
cid=1
- 检查模板标题属性title @项目周报模板
- 获取holder数据
- 属性name @weekly_term
- 属性text @报告周期
- 属性hint @筛选条件:“date”介于本周
- 检查区块数量 @6
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/weekly.unittest.class.php';
zenData('user')->gen(5);
su('admin');
$weeklyTester = new weeklyTest();
$content = $weeklyTester->getBuildinRawContentTest();
r($content['meta']) && p('title') && e('项目周报模板'); // 检查模板标题
r($content['blocks']['children'][0]['children'][0]['props']['text']['delta'][0]['attributes']['holder']) && p('name,text,hint') && e('weekly_term,报告周期,筛选条件:“date”介于本周'); // 获取holder数据
r(count($content['blocks'])) && p() && e('6'); // 检查区块数量