* Add gitlab unit test.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::apiCreateGroup();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 使用空的名字创建gitlab群组 @return false
|
||||
- 使用空的群组URL创建gitlab群组 @return false
|
||||
- 使用错误gitlabID创建群组 @0
|
||||
- 通过gitlabID,projectID,分支对象正确创建GitLab分支 @1
|
||||
- 使用重复的分支信息创建分支属性message @Failed to save group {:path=>["已经被使用"]}
|
||||
|
||||
*/
|
||||
|
||||
zdTable('pipeline')->gen(5);
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
$gitlabID = 1;
|
||||
$group = new stdclass();
|
||||
$group->name = '';
|
||||
$group->path = 'unit_test_group17';
|
||||
$group->description = 'unit_test_group desc';
|
||||
$group->visibility = 'public';
|
||||
$group->request_access_enabled = '1';
|
||||
$group->lfs_enabled = '1';
|
||||
$group->project_creation_level = 'developer';
|
||||
$group->subgroup_creation_level = 'maintainer';
|
||||
|
||||
$result = $gitlab->apiCreateGroup($gitlabID, $group);
|
||||
if($result === false) $result = 'return false';
|
||||
r($result) && p() && e('return false'); //使用空的名字创建gitlab群组
|
||||
|
||||
$group->name = 'unitTestGroup17';
|
||||
$group->path = '';
|
||||
$result = $gitlab->apiCreateGroup($gitlabID, $group);
|
||||
if($result === false) $result = 'return false';
|
||||
r($result) && p() && e('return false'); //使用空的群组URL创建gitlab群组
|
||||
|
||||
r($gitlab->apiCreateGroup(0, $group)) && p() && e('0'); //使用错误gitlabID创建群组
|
||||
|
||||
$group->path = 'unit_test_group17';
|
||||
$result = $gitlab->apiCreateGroup($gitlabID, $group);
|
||||
if(!empty($result->name) and $result->name == $group->name) $result = true;
|
||||
if(!empty($result->message) and $result->message == 'Failed to save group {:path=>["已经被使用"]}') $result = true;
|
||||
r($result) && p() && e('1'); //通过gitlabID,projectID,分支对象正确创建GitLab分支
|
||||
r($gitlab->apiCreateGroup($gitlabID, $group)) && p('message') && e('Failed to save group {:path=>["已经被使用"]}'); //使用重复的分支信息创建分支
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::apiCreateProject();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 使用空的名字创建gitlab群组 @return false
|
||||
- 使用空的群组URL创建gitlab群组 @return false
|
||||
- 使用错误gitlabID创建群组 @0
|
||||
- 通过gitlabID,projectID,分支对象正确创建GitLab分支 @1
|
||||
- 使用重复的分支信息创建分支属性message @Failed to save project {:path=>["已经被使用"]}
|
||||
|
||||
*/
|
||||
|
||||
zdTable('pipeline')->gen(5);
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
$gitlabID = 1;
|
||||
$project = new stdclass();
|
||||
$project->name = '';
|
||||
$project->path = 'unit_test_project17';
|
||||
$project->description = 'unit_test_project desc';
|
||||
$project->visibility = 'public';
|
||||
$project->namespace_id = '1';
|
||||
|
||||
$result = $gitlab->apiCreateProject($gitlabID, $project);
|
||||
if($result === false) $result = 'return false';
|
||||
r($result) && p() && e('return false'); //使用空的名字创建gitlab群组
|
||||
|
||||
$project->name = 'unitTestProject17';
|
||||
$project->path = '';
|
||||
$result = $gitlab->apiCreateProject($gitlabID, $project);
|
||||
if($result === false) $result = 'return false';
|
||||
r($result) && p() && e('return false'); //使用空的群组URL创建gitlab群组
|
||||
|
||||
r($gitlab->apiCreateProject(0, $project)) && p() && e('0'); //使用错误gitlabID创建群组
|
||||
|
||||
$project->path = 'unit_test_project17';
|
||||
$result = $gitlab->apiCreateProject($gitlabID, $project);
|
||||
if(!empty($result->name) and $result->name == $project->name) $result = true;
|
||||
if(!empty($result->message->path[0]) and $result->message->path[0] == '已经被使用') $result = true;
|
||||
r($result) && p() && e('1'); //通过gitlabID,projectID,分支对象正确创建GitLab分支
|
||||
|
||||
$result = $gitlab->apiCreateProject($gitlabID, $project);
|
||||
r($result->message) && p('path:0') && e('已经被使用'); //使用重复的分支信息创建分支
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::apiCreateProjectMember();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 使用空的user_id创建gitlab群组 @return false
|
||||
- 使用空的access_level创建gitlab群组 @return false
|
||||
- 使用错误gitlabID创建群组 @0
|
||||
- 通过gitlabID,projectID,分支对象正确创建GitLab分支 @1
|
||||
- 使用重复的分支信息创建分支属性message @Member already exists
|
||||
|
||||
*/
|
||||
|
||||
zdTable('pipeline')->gen(5);
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
$gitlabID = 1;
|
||||
$projectID = 4;
|
||||
|
||||
$projectMember = new stdclass();
|
||||
$projectMember->user_id = '';
|
||||
$projectMember->access_level = '40';
|
||||
|
||||
$result = $gitlab->apiCreateProjectMember($gitlabID, $projectID, $projectMember);
|
||||
if($result === false) $result = 'return false';
|
||||
r($result) && p() && e('return false'); //使用空的user_id创建gitlab群组
|
||||
|
||||
$projectMember->user_id = '4';
|
||||
$projectMember->access_level = '';
|
||||
$result = $gitlab->apiCreateProjectMember($gitlabID, $projectID, $projectMember);
|
||||
if($result === false) $result = 'return false';
|
||||
r($result) && p() && e('return false'); //使用空的access_level创建gitlab群组
|
||||
|
||||
r($gitlab->apiCreateProjectMember(0, $projectID, $projectMember)) && p() && e('0'); //使用错误gitlabID创建群组
|
||||
|
||||
$projectMember->access_level = '40';
|
||||
$result = $gitlab->apiCreateProjectMember($gitlabID, $projectID, $projectMember);
|
||||
if(!empty($result->access_level) and $result->access_level == $projectMember->access_level) $result = true;
|
||||
if(!empty($result->message) and $result->message == 'Member already exists') $result = true;
|
||||
r($result) && p() && e('1'); //通过gitlabID,projectID,分支对象正确创建GitLab分支
|
||||
|
||||
r( $gitlab->apiCreateProjectMember($gitlabID, $projectID, $projectMember)) && p('message') && e('Member already exists'); //使用重复的分支信息创建分支
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::apiGetNamespaces();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 通过gitlabID,获取GitLab namespace列表 @1
|
||||
- 通过gitlabID,获取GitLab namespace数量 @1
|
||||
- 通过错误的gitlabID获取namespace列表 @0
|
||||
- 通过错误的gitlabID获取namespace列表数量 @0
|
||||
|
||||
*/
|
||||
|
||||
zdTable('pipeline')->gen(5);
|
||||
zdTable('oauth')->gen(4);
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
$gitlabID = 1;
|
||||
|
||||
$result = $gitlab->apiGetNamespaces($gitlabID);
|
||||
r(isset($result[0]->path)) && p() && e('1'); //通过gitlabID,获取GitLab namespace列表
|
||||
r(count($result) > 0) && p() && e('1'); //通过gitlabID,获取GitLab namespace数量
|
||||
|
||||
$result = $gitlab->apiGetNamespaces(0);
|
||||
r($result) && p() && e('0'); //通过错误的gitlabID获取namespace列表
|
||||
r(count($result)) && p() && e('0'); //通过错误的gitlabID获取namespace列表数量
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::apiGetProjects();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 通过gitlabID获取GitLab项目列表 @1
|
||||
- 通过gitlabID获取GitLab项目数量 @1
|
||||
- 通过gitlabID获取GitLab项目列表是否有visibility字段信息。 @0
|
||||
- 当gitlabID为0时,获取GitLab项目列表 @return empty
|
||||
- 通过gitlabID simple字段为false获取GitLab项目列表第0条的visibility属性 @private
|
||||
- 通过gitlabID minID为4获取GitLab项目列表第0条的name属性 @privateTest
|
||||
- 通过gitlabID maxID为4获取GitLab项目列表第0条的name属性 @testHtml
|
||||
|
||||
*/
|
||||
|
||||
zdTable('pipeline')->gen(5);
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
$gitlabID = 1;
|
||||
$orderBy = 'id_desc';
|
||||
$simple = 'true';
|
||||
|
||||
$result = $gitlab->apiGetProjects($gitlabID, $simple);
|
||||
r(isset($result[0]->name)) && p() && e('1'); //通过gitlabID获取GitLab项目列表
|
||||
r(count($result) > 0) && p() && e('1'); //通过gitlabID获取GitLab项目数量
|
||||
r(isset($result[0]->visibility)) && p() && e('0'); //通过gitlabID获取GitLab项目列表是否有visibility字段信息。
|
||||
|
||||
$gitlabID = 0;
|
||||
$result = $gitlab->apiGetProjects($gitlabID, $simple);
|
||||
if(empty($result)) $result = 'return empty';
|
||||
r($result) && p() && e('return empty'); //当gitlabID为0时,获取GitLab项目列表
|
||||
|
||||
$gitlabID = 1;
|
||||
$simple = 'false';
|
||||
$result = $gitlab->apiGetProjects($gitlabID, $simple);
|
||||
r($result) && p('0:visibility') && e('private'); //通过gitlabID simple字段为false获取GitLab项目列表
|
||||
|
||||
$simple = 'true';
|
||||
$minID = 4;
|
||||
$result = $gitlab->apiGetProjects($gitlabID, $simple, $minID);
|
||||
r($result) && p('0:name') && e('privateTest'); //通过gitlabID minID为4获取GitLab项目列表
|
||||
|
||||
$simple = 'true';
|
||||
$maxID = 2;
|
||||
$result = $gitlab->apiGetProjects($gitlabID, $simple, 0, $maxID);
|
||||
r($result) && p('0:name') && e('testHtml'); //通过gitlabID maxID为4获取GitLab项目列表
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::apiGetProjectsPager();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 通过gitlabID,projectID,获取GitLab项目列表 @1
|
||||
- 通过gitlabID,projectID,获取GitLab项目数量 @1
|
||||
- 当gitlabID为0时,获取GitLab项目列表 @return empty
|
||||
- 通过gitlabID,projectID,按项目名升序获取GitLab项目列表第1条的name属性 @testHtml
|
||||
- 通过gitlabID,projectID,搜索字符'zentaopms_15.2_20210720'获取GitLab项目列表第0条的name属性 @privateProject
|
||||
|
||||
*/
|
||||
|
||||
zdTable('pipeline')->gen(5);
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
$gitlab->app->moduleName = 'gitlab';
|
||||
$gitlab->app->methodName = 'browse';
|
||||
|
||||
$gitlabID = 1;
|
||||
$orderBy = 'id_desc';
|
||||
$keyword = '';
|
||||
|
||||
$pager = new stdclass();
|
||||
$pager->recPerPage = 5;
|
||||
$pager->pageID = 1;
|
||||
|
||||
$result = $gitlab->apiGetProjectsPager($gitlabID, $keyword, $orderBy, $pager);
|
||||
r(isset($result['projects'][0]->name)) && p() && e('1'); //通过gitlabID,获取GitLab项目列表
|
||||
r(count($result['projects']) > 0) && p() && e('1'); //通过gitlabID,获取GitLab项目数量
|
||||
|
||||
$gitlabID = 0;
|
||||
$result = $gitlab->apiGetProjectsPager($gitlabID, $keyword, $orderBy, $pager);
|
||||
if(empty($result)) $result = 'return empty';
|
||||
r($result) && p() && e('return empty'); //当gitlabID为0时,获取GitLab项目列表
|
||||
|
||||
$gitlabID = 1;
|
||||
$orderBy = 'id_asc';
|
||||
$result = $gitlab->apiGetProjectsPager($gitlabID, $keyword, $orderBy, $pager);
|
||||
r($result['projects']) && p('1:name') && e('testHtml'); //通过gitlabID,按项目名升序获取GitLab项目列表
|
||||
|
||||
$keyword = 'private';
|
||||
$result = $gitlab->apiGetProjectsPager($gitlabID, $keyword, $orderBy, $pager);
|
||||
r($result['projects']) && p('0:name') && e('privateProject'); //通过gitlabID,搜索字符'private'获取GitLab项目列表
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::apiGetTodoList();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 通过gitlabID,projectID,超级管理员获取GitLab待办列表 @1
|
||||
- 通过gitlabID,projectID,超级管理员获取GitLab待办数量 @1
|
||||
- 当前项目没有待办时,获取GitLab待办列表 @0
|
||||
- 当前项目有待办时,指定用户获取GitLab待办列表 @0
|
||||
- 当gitlabID存在,projectID不存在时,获取GitLab待办列表 @return empty
|
||||
- 当gitlabID,projectID都为0时,获取GitLab待办列表 @return empty
|
||||
|
||||
*/
|
||||
|
||||
zdTable('pipeline')->gen(5);
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
$gitlabID = 1;
|
||||
$projectID = 3;
|
||||
$sudo = 1;
|
||||
$result = $gitlab->apiGetTodoList($gitlabID, $projectID, $sudo);
|
||||
r(isset(array_shift($result)->author)) && p() && e('1'); //通过gitlabID,projectID,超级管理员获取GitLab待办列表
|
||||
r(count($result) > 0) && p() && e('1'); //通过gitlabID,projectID,超级管理员获取GitLab待办数量
|
||||
|
||||
$gitlabID = 1;
|
||||
$projectID = 2;
|
||||
r(count($gitlab->apiGetTodoList($gitlabID, $projectID, $sudo))) && p() && e('0'); //当前项目没有待办时,获取GitLab待办列表
|
||||
|
||||
$projectID = 3;
|
||||
$sudo = 4;
|
||||
r(count($gitlab->apiGetTodoList($gitlabID, $projectID, $sudo))) && p() && e('0'); //当前项目有待办时,指定用户获取GitLab待办列表
|
||||
|
||||
$gitlabID = 1;
|
||||
$projectID = 0;
|
||||
$result = $gitlab->apiGetTodoList($gitlabID, $projectID, $sudo);
|
||||
if(empty($result)) $result = 'return empty';
|
||||
r($result) && p() && e('return empty'); //当gitlabID存在,projectID不存在时,获取GitLab待办列表
|
||||
|
||||
$gitlabID = 0;
|
||||
$projectID = 0;
|
||||
$result = $gitlab->apiGetTodoList($gitlabID, $projectID, $sudo);
|
||||
if(empty($result)) $result = 'return empty';
|
||||
r($result) && p() && e('return empty'); //当gitlabID,projectID都为0时,获取GitLab待办列表
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::apiGetUsers();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 通过gitlabID,onlyLinked,获取GitLab用户列表 @1
|
||||
- 通过gitlabID,onlyLinked,获取GitLab用户数量 @1
|
||||
- 获取GitLab用户已做了关联的用户列表第0条的account属性 @user6
|
||||
- 获取GitLab用户已做了关联的用户列表数量 @2
|
||||
- 通过gitlabID,onlyLinked,按用户名升序获取GitLab用户列表第0条的account属性 @root
|
||||
|
||||
*/
|
||||
|
||||
zdTable('pipeline')->gen(5);
|
||||
zdTable('oauth')->gen(4);
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
$gitlabID = 1;
|
||||
$onlyLinked = false;
|
||||
$result = $gitlab->apiGetUsers($gitlabID, $onlyLinked);
|
||||
r(isset($result[0]->account)) && p() && e('1'); //通过gitlabID,onlyLinked,获取GitLab用户列表
|
||||
r(count($result) > 0) && p() && e('1'); //通过gitlabID,onlyLinked,获取GitLab用户数量
|
||||
|
||||
$gitlabID = 1;
|
||||
$onlyLinked = true;
|
||||
$result = $gitlab->apiGetUsers($gitlabID, $onlyLinked);
|
||||
r($result) && p('0:account') && e('user6'); //获取GitLab用户已做了关联的用户列表
|
||||
r(count($result)) && p() && e('2'); //获取GitLab用户已做了关联的用户列表数量
|
||||
|
||||
$gitlabID = 1;
|
||||
$onlyLinked = false;
|
||||
$orderBy = 'id_asc';
|
||||
$result = $gitlab->apiGetUsers($gitlabID, $onlyLinked, $orderBy);
|
||||
r($result) && p('0:account') && e('root'); //通过gitlabID,onlyLinked,按用户名升序获取GitLab用户列表
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::getListByAccount();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 默认admin用户查询绑定的gitlab服务器 @0
|
||||
- 使用已绑定一个gitlab服务器的用户查询 @1
|
||||
- 使用未绑定gitlab服务器的用户查询 @0
|
||||
|
||||
*/
|
||||
|
||||
zdTable('oauth')->gen(5);
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
r(count($gitlab->getListByAccount())) && p() && e('0'); //默认admin用户查询绑定的gitlab服务器
|
||||
r(count($gitlab->getListByAccount('user3'))) && p() && e('1'); //使用已绑定一个gitlab服务器的用户查询
|
||||
r(count($gitlab->getListByAccount('test1'))) && p() && e('0'); //使用未绑定gitlab服务器的用户查询
|
||||
@@ -32,6 +32,6 @@ $gitlabUsers = $gitlab->gitlab->apiGetUsers($gitlabID);
|
||||
$zentaoUsers = $gitlab->gitlab->dao->select('account,email,realname')->from(TABLE_USER)->where('deleted')->eq('0')->fetchAll('account');
|
||||
$matchedUsers = $gitlab->getMatchedUsersTest($gitlabID, $gitlabUsers, $zentaoUsers);
|
||||
r($matchedUsers) && p('1:account,zentaoAccount') && e('root,user3'); // 获取gitlab服务器1匹配的用户列表。
|
||||
r(count($matchedUsers)) && p('') && e('2'); // 获取gitlab服务器1匹配的用户数量。
|
||||
r(count($matchedUsers)) && p('') && e('3'); // 获取gitlab服务器1匹配的用户数量。
|
||||
r($gitlab->getMatchedUsersTest($gitlabID, array(), $zentaoUsers)) && p('') && e('0'); // 当gitlab用户为空时获取gitlab服务器1匹配的用户数量。
|
||||
r($gitlab->getMatchedUsersTest($gitlabID, $gitlabUsers, array())) && p('4:account,zentaoAccount') && e('user6,user6'); // 当禅道用户为空时获取gitlab服务器1匹配的用户数量。
|
||||
r($gitlab->getMatchedUsersTest($gitlabID, $gitlabUsers, array())) && p('4:account,zentaoAccount') && e('user6,user6'); // 当禅道用户为空时获取gitlab服务器1匹配的用户数量。
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/gitlab.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试gitlabModel->getUserAccountIdPairs();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 获取用户名为user3绑定的gitlab用户id。属性user3 @1
|
||||
- 获取用户名为user5绑定的gitlab用户id。属性user5 @3
|
||||
- 获取GitLab服务器不存在的绑定。属性user3 @0
|
||||
|
||||
*/
|
||||
|
||||
zdTable('user')->gen(10);
|
||||
zdTable('oauth')->gen(5);
|
||||
|
||||
$gitlab = new gitlabTest();
|
||||
|
||||
r($gitlab->getUserAccountIdPairsTest($gitlabID = 1)) && p('user3') && e('1'); // 获取用户名为user3绑定的gitlab用户id。
|
||||
r($gitlab->getUserAccountIdPairsTest($gitlabID = 1)) && p('user5') && e('3'); // 获取用户名为user5绑定的gitlab用户id。
|
||||
r($gitlab->getUserAccountIdPairsTest($gitlabID = 10)) && p('user3') && e('0'); // 获取GitLab服务器不存在的绑定。
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/gitlab.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试gitlabModel->getUserIdAccountPairs();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 获取GitLab服务器1用户id为1的绑定的用户名。属性1 @user3
|
||||
- 获取GitLab服务器1用户id为3的绑定的用户名。属性3 @user5
|
||||
- 获取GitLab服务器不存在用户id为3的绑定的用户名。属性1 @0
|
||||
|
||||
*/
|
||||
|
||||
zdTable('user')->gen(10);
|
||||
zdTable('oauth')->gen(5);
|
||||
|
||||
$gitlab = new gitlabTest();
|
||||
|
||||
r($gitlab->getUserIdAccountPairsTest($gitlabID = 1)) && p('1') && e('user3'); // 获取GitLab服务器1用户id为1的绑定的用户名。
|
||||
r($gitlab->getUserIdAccountPairsTest($gitlabID = 1)) && p('3') && e('user5'); // 获取GitLab服务器1用户id为3的绑定的用户名。
|
||||
r($gitlab->getUserIdAccountPairsTest($gitlabID = 10)) && p('1') && e('0'); // 获取GitLab服务器不存在用户id为3的绑定的用户名。
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/gitlab.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试gitlabModel->getUserIDByZentaoAccount();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 根据禅道账号user3获取gitlab用户id。 @1
|
||||
- 根据禅道账号user5获取gitlab用户id。 @3
|
||||
- 根据禅道账号user3获取不存在的gitlab用户id。 @0
|
||||
|
||||
*/
|
||||
|
||||
zdTable('user')->gen(10);
|
||||
zdTable('oauth')->gen(5);
|
||||
|
||||
$gitlab = new gitlabTest();
|
||||
|
||||
r($gitlab->getUserIDByZentaoAccountTest($gitlabID = 1, 'user3')) && p() && e('1'); // 根据禅道账号user3获取gitlab用户id。
|
||||
r($gitlab->getUserIDByZentaoAccountTest($gitlabID = 1, 'user5')) && p() && e('3'); // 根据禅道账号user5获取gitlab用户id。
|
||||
r($gitlab->getUserIDByZentaoAccountTest($gitlabID = 10, 'user3')) && p() && e('0'); // 根据禅道账号user3获取不存在的gitlab用户id。
|
||||
Reference in New Issue
Block a user