From 6985783f0afc2b166cafb5ef8e78e589a3987a93 Mon Sep 17 00:00:00 2001 From: zenggang Date: Thu, 9 Dec 2021 06:57:48 +0000 Subject: [PATCH] * Add pipeline data and apigetbranches model method --- test/data/pipeline.yaml | 26 +++++++++++++++++++ test/data/zentao/config.php | 2 ++ test/model/gitlab/apigetbranches.php | 39 ++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 test/data/pipeline.yaml create mode 100755 test/model/gitlab/apigetbranches.php diff --git a/test/data/pipeline.yaml b/test/data/pipeline.yaml new file mode 100644 index 0000000000..1f79677b14 --- /dev/null +++ b/test/data/pipeline.yaml @@ -0,0 +1,26 @@ +title: zt_pipeline +author: Zeng gang +version: "1.0" +fields: + - field: id + range: 1 + - field: type + range: gitlab + - field: name + range: gitlab服务器 + - field: url + range: [http://192.168.1.161:51080] + - field: account + range: [] + - field: password + range: [] + - field: token + range: x88fZokrp5hShia2jyBN + - field: private + range: 08bcc98f75d7d40053dc80722bdc117b + - field: createdBy + range: admin + - field: createdDate + range: [2021-12-09 11:23:35] + - field: deleted + range: 0 diff --git a/test/data/zentao/config.php b/test/data/zentao/config.php index af1441d34a..2e0255f1b6 100644 --- a/test/data/zentao/config.php +++ b/test/data/zentao/config.php @@ -29,3 +29,5 @@ $builder->projectProduct = array('rows' => 21, 'data' => array('projectproduct' $builder->case = array('rows' => 10000, 'data' => array('case')); $builder->bug = array('rows' => 100, 'data' => array('bug')); + +$builder->pipeline = array('rows' => 1, 'data' => array('pipeline')); diff --git a/test/model/gitlab/apigetbranches.php b/test/model/gitlab/apigetbranches.php new file mode 100755 index 0000000000..643d88daa0 --- /dev/null +++ b/test/model/gitlab/apigetbranches.php @@ -0,0 +1,39 @@ +#!/usr/bin/env php +> branch1 +通过gitlabID,projectID,获取GitLab分支数量 >> 3 +当前项目没有分支时,获取GitLab分支列表 >> 0 +当gitlabID存在,projectID不存在时,获取GitLab分支列表 >> 404 Project Not Found +当gitlabID,projectID都为0时,获取GitLab分支列表 >> return empty + +*/ + +$gitlab = $tester->loadModel('gitlab'); + +$gitlabID = 1; +$projectID = 1552; +$result = $gitlab->apiGetBranches($gitlabID, $projectID); +r($result) && p('0:name') && e('branch1'); //通过gitlabID,projectID,获取GitLab分支列表 +r(count($result)) && p() && e(3); //通过gitlabID,projectID,获取GitLab分支数量 + +$gitlabID = 1; +$projectID = 1570; +r(count($gitlab->apiGetBranches($gitlabID, $projectID))) && p() && e(0); //当前项目没有分支时,获取GitLab分支列表 + +$gitlabID = 1; +$projectID = 0; +r($gitlab->apiGetBranches($gitlabID, $projectID)) && p('message') && e('404 Project Not Found'); //通过gitlabID,projectID,获取GitLab分支列表 + +$gitlabID = 0; +$projectID = 0; +$result = $gitlab->apiGetBranches($gitlabID, $projectID); +if(empty($result)) $result = 'return empty'; +r($result) && p() && e('return empty'); //当gitlabID,projectID都为0时,获取GitLab分支列表