+ Add doc::processDocForUpdate unit test.

This commit is contained in:
tianshujie
2023-12-02 17:11:13 +08:00
parent c97dce79fc
commit 12ac0fbe9e
2 changed files with 64 additions and 0 deletions
+24
View File
@@ -239,6 +239,30 @@ class docTest
return $objects['changes'];
}
/**
* 为更新文档处理数据。
* Process data for update a doc.
*
* @param int $docID
* @param array $param
* @access public
* @return object
*/
public function processDocForUpdateTest(int $docID, array $param): object
{
$createFields = array('lib' => 0, 'module' => 0, 'title' => '', 'keywords' => '', 'type' => 'text', 'content' => '', 'contentType' => 'html', 'acl' => 'private', 'status' => 'normal');
$doc = new stdclass();
foreach($createFields as $field => $defaultValue) $doc->{$field} = $defaultValue;
foreach($param as $key => $value) $doc->{$key} = $value;
$oldDoc = $this->objectModel->getByID($docID);
$data = $this->objectModel->processDocForUpdate($oldDoc, $doc);
if(dao::isError()) return dao::getError();
return $data[0];
}
/**
* Function saveDraft test by doc
*