* Refactor doc::getToAndCcList unit test.
This commit is contained in:
@@ -429,20 +429,21 @@ class docTest
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收信人和抄送人列表。
|
||||
* Get toList and ccList.
|
||||
*
|
||||
* @param int $docID
|
||||
* @param string $mailto
|
||||
* @access public
|
||||
* @return bool|array
|
||||
*/
|
||||
public function getToAndCcListTest($docID)
|
||||
public function getToAndCcListTest(string $mailto): bool|array
|
||||
{
|
||||
$doc = $this->objectModel->getByID($docID);
|
||||
$objects = $this->objectModel->getToAndCcList($doc);
|
||||
$doc = new stdclass();
|
||||
$doc->mailto = $mailto;
|
||||
$data = $this->objectModel->getToAndCcList($doc);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function selectTest($type, $objects, $objectID, $libs, $libID = 0)
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/doc.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 docModel->getToAndCcList();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
- 测试抄送人为空时,获取的收信人列表 @0
|
||||
- 测试抄送人为admin时,获取的收信人列表 @admin
|
||||
- 测试抄送人为admin,user1时,获取的抄送人列表属性1 @user1
|
||||
|
||||
*/
|
||||
$docID = array('1', '2', '3');
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/doc.class.php';
|
||||
|
||||
$doc = new docTest();
|
||||
zdTable('user')->gen(5);
|
||||
|
||||
r($doc->getToAndCcListTest($docID[0])) && p('0;1') && e('admin;'); //查询文档type为text的数据
|
||||
r($doc->getToAndCcListTest($docID[1])) && p('0;1') && e('admin;'); //查询文档type为markdown的数据
|
||||
r($doc->getToAndCcListTest($docID[2])) && p('0;1') && e('admin;'); //查询文档type为url的数据
|
||||
$mailtoList = array('', 'admin', 'admin,user1');
|
||||
|
||||
$docTester = new docTest();
|
||||
r($docTester->getToAndCcListTest($mailtoList[0])) && p() && e('0'); // 测试抄送人为空时,获取的收信人列表
|
||||
r($docTester->getToAndCcListTest($mailtoList[1])) && p('0') && e('admin'); // 测试抄送人为admin时,获取的收信人列表
|
||||
r($docTester->getToAndCcListTest($mailtoList[2])) && p('1') && e('user1'); // 测试抄送人为admin,user1时,获取的抄送人列表
|
||||
|
||||
Reference in New Issue
Block a user