* Fix checkpriv and create unittest.

This commit is contained in:
denghongtao
2022-10-10 03:00:41 +00:00
parent 01fac13aee
commit 24cad9ceda
3 changed files with 12 additions and 11 deletions
+2 -3
View File
@@ -68,10 +68,9 @@ class repoTest
public function createTest($list)
{
$create = array();
$getCreate = array('SCM' => '', 'serviceHost' => '', 'serviceProject' => '', 'name' => '', 'path' => '', 'encoding' => '', 'client' => '', 'account' => '', 'password' => '', 'encrypt' => '', 'desc' => '', 'uid' => '');
$init = array('SCM' => '', 'serviceHost' => '', 'serviceProject' => '', 'name' => '', 'path' => '', 'encoding' => '', 'client' => '', 'account' => '', 'password' => '', 'encrypt' => '', 'desc' => '', 'uid' => '');
foreach($getCreate as $filed => $defaultvalue) $_POST[$filed] = $defaultvalue;
foreach($init as $filed => $defaultvalue) $_POST[$filed] = $defaultvalue;
foreach($list as $key => $value) $_POST[$key] = $value;
$objects = $this->objectModel->create();
+2 -2
View File
@@ -10,7 +10,7 @@ title=测试 repoModel->checkPriv();
cid=1
pid=1
>> 0
检查用户权限,返回布尔值 >> 0
*/
@@ -22,4 +22,4 @@ $repo->acl->user = 'admin';
$result = $checkPriv->checkPrivTest($repo);
r($result) && p($result) && e('0');
r($result) && p($result) && e('0'); //检查用户权限,返回布尔值
+8 -6
View File
@@ -10,9 +10,9 @@ title=测试 repoModel->create();
cid=1
pid=1
>> 1
>> 『名称』已经有『jktest』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。
>> 因为安全原因,需要检测客户端版本,请将版本号写入文件
正常创建gitlab版本库 >> 1
当已有版本库时提示已有记录 >> 『名称』已经有『jktest』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。
当数据类型为Gitea时提示写版本号 >> 因为安全原因,需要检测客户端版本,请将版本号写入文件
*/
@@ -53,6 +53,8 @@ $resultOne = $repo->createTest($list);
$resultTwo = $repo->createTest($list);
$resultThree = $repo->createTest($listOne);
r($resultOne) && p($resultOne) && e('1');
r($resultTwo) && p('name:0') && e('『名称』已经有『jktest』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。');
r($resultThree) && p($resultThree) && e('因为安全原因,需要检测客户端版本,请将版本号写入文件');
r($resultOne) && p($resultOne) && e('1'); //正常创建gitlab版本库
r($resultTwo) && p('name:0') && e('『名称』已经有『jktest』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); //当已有版本库时提示已有记录
r($resultThree) && p($resultThree) && e('因为安全原因,需要检测客户端版本,请将版本号写入文件'); //当数据类型为Gitea时提示写版本号
$db->restoreDB();