* [unittest] add unittest for addBuiltinTemplate method.
This commit is contained in:
@@ -773,7 +773,7 @@ class weeklyModel extends model
|
||||
{
|
||||
if(isset($delta->attributes->holder->id)) $delta->attributes->holder->id = uniqid();
|
||||
if(isset($delta->attributes->holder->name) && isset($blockIdList[$delta->attributes->holder->name])) $delta->attributes->holder->name = "{$delta->attributes->holder->name}_{$blockIdList[$delta->attributes->holder->name]}";
|
||||
if(isset($delta->attributes->holder->data->blockID)) $delta->attributes->holder->data->blockID = $blockIdList[$delta->attributes->holder->data->type];
|
||||
if(isset($delta->attributes->holder->data->blockID) && isset($blockIdList[$delta->attributes->holder->data->type])) $delta->attributes->holder->data->blockID = $blockIdList[$delta->attributes->holder->data->type];
|
||||
}
|
||||
}
|
||||
if(!empty($child->props->content)) $child->props->content->fetcher = str_replace($blockCodes, array_values($blockIdList), $child->props->content->fetcher);
|
||||
|
||||
@@ -402,4 +402,21 @@ class weeklyTest
|
||||
$categroyID = $this->objectModel->addBuiltinCategory($scopeID);
|
||||
return $this->objectModel->dao->select('*')->from(TABLE_MODULE)->where('id')->eq($categroyID)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加内置报告模板。
|
||||
* Add builtin report template.
|
||||
*
|
||||
* @access public
|
||||
* @return array|object
|
||||
*/
|
||||
public function addBuiltinTemplateTest(): array|object
|
||||
{
|
||||
$scopeID = $this->objectModel->addBuiltinScope();
|
||||
$categroyID = $this->objectModel->addBuiltinCategory($scopeID);
|
||||
$this->objectModel->addBuiltinTemplate($scopeID, $categroyID, array());
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $this->objectModel->dao->select('*')->from(TABLE_DOC)->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
|
||||
title=测试 weeklyModel->addBuiltinTemplate();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试添加内置模板
|
||||
- 属性title @项目周报模板
|
||||
- 属性type @text
|
||||
- 属性status @normal
|
||||
- 属性acl @open
|
||||
- 属性builtIn @1
|
||||
- 属性templateType @reportTemplate
|
||||
- 属性cycle @week
|
||||
- 属性addedBy @system
|
||||
|
||||
*/
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/weekly.unittest.class.php';
|
||||
|
||||
zenData('action')->gen(0);
|
||||
zenData('doclib')->gen(0);
|
||||
zenData('module')->gen(0);
|
||||
zenData('workflowgroup')->gen(0);
|
||||
zenData('doc')->gen(0);
|
||||
zenData('doccontent')->gen(0);
|
||||
zenData('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$weeklyTester = new weeklyTest();
|
||||
r($weeklyTester->addBuiltinTemplateTest()) && p('title,type,status,acl,builtIn,templateType,cycle,addedBy') && e('项目周报模板,text,normal,open,1,reportTemplate,week,system'); // 测试添加内置模板
|
||||
Reference in New Issue
Block a user