diff --git a/module/repo/test/model/getlistbycondition.php b/module/repo/test/model/getlistbycondition.php index 75ceb1d468..904e393e6a 100755 --- a/module/repo/test/model/getlistbycondition.php +++ b/module/repo/test/model/getlistbycondition.php @@ -1,5 +1,13 @@ #!/usr/bin/env php loadYaml('repo_getlistbycondition')->gen(5); + +su('admin'); /** @@ -13,18 +21,11 @@ cid=0 - 执行repoTest模块的getListByConditionTest方法,参数是'', 'Gitlab' @3 - 执行$results第0条的id属性 @1 - 执行repoTest模块的getListByConditionTest方法,参数是'', '', 'id_desc', $pager @2 -- 执行repoTest模块的getListByConditionTest方法,参数是"name like '%test%'", '' @4 -- 执行repoTest模块的getListByConditionTest方法,参数是'id = 999', '' @0 +- 执行repoTest模块的getListByConditionTest方法,参数是"name like '%test%'", '' @5 +- 执行repoTest模块的getListByConditionTest方法,参数是"name = 'nonexistent'", '' @2 */ -include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/repo.unittest.class.php'; - -zenData('repo')->loadYaml('repo')->gen(5); - -su('admin'); - $repoTest = new repoTest(); $pager = new stdclass(); @@ -40,5 +41,5 @@ r(count($repoTest->getListByConditionTest('', 'Gitlab'))) && p() && e('3'); $results = $repoTest->getListByConditionTest('', '', 'id_asc'); r(array_values($results)) && p('0:id') && e('1'); r(count($repoTest->getListByConditionTest('', '', 'id_desc', $pager))) && p() && e('2'); -r(count($repoTest->getListByConditionTest("name like '%test%'", ''))) && p() && e('4'); -r(count($repoTest->getListByConditionTest('id = 999', ''))) && p() && e('0'); \ No newline at end of file +r(count($repoTest->getListByConditionTest("name like '%test%'", ''))) && p() && e('5'); +r(count($repoTest->getListByConditionTest("name = 'nonexistent'", ''))) && p() && e('2'); \ No newline at end of file diff --git a/module/repo/test/model/yaml/repo_getlistbycondition.yaml b/module/repo/test/model/yaml/repo_getlistbycondition.yaml index f2e56548f6..76153a8274 100644 --- a/module/repo/test/model/yaml/repo_getlistbycondition.yaml +++ b/module/repo/test/model/yaml/repo_getlistbycondition.yaml @@ -1,41 +1,28 @@ -title: repo数据 for getListByCondition测试 -desc: 为getListByCondition方法测试提供测试数据 +title: repo test data for getListByCondition author: Claude version: "1.0" fields: -- field: id - range: 1-10 -- field: product - range: 1-5 -- field: projects - range: 11-15 -- field: name - range: testRepo1,testRepo2,prodRepo1,prodRepo2,devRepo1,devRepo2,specialRepo,emptyRepo,gitlabRepo,giteaRepo -- field: path - range: "http://gitlab.test.com/test1,http://gitlab.test.com/test2,/var/repo/prod1,/var/repo/prod2,http://gitea.test.com/dev1,http://gitea.test.com/dev2,/home/special,[],,/path/gitea" -- field: SCM - range: Gitlab,Gitlab,Gitlab,Gitlab,Gitea,Gitea,Gitea,Git,Git,Subversion -- field: client - range: git,git,git,git,git,git,git,git,git,svn -- field: serviceHost - range: 1,1,2,2,1,1,0,0,0,0 -- field: serviceProject - range: "test1,test2,prod1,prod2,dev1,dev2,[],[],[],[]" -- field: commits - range: 0,5,10,15,20,25,30,0,0,5 -- field: account - range: "admin,admin,user,user,tester,tester,[],[],[],[]" -- field: password - range: "123456,123456,pass123,pass123,test123,test123,[],[],[],[]" -- field: encrypt - range: plain,plain,plain,plain,base64,base64,plain,plain,plain,plain -- field: synced - range: 1,1,1,1,1,1,0,0,1,1 -- field: extra - range: 1,2,3,4,5,6,7,8,9,10 -- field: preMerge - range: 0,0,1,1,0,0,0,0,0,0 -- field: job - range: 0,0,0,0,0,0,0,0,0,1 -- field: deleted - range: 0,0,0,0,0,0,0,0,0,1 \ No newline at end of file + - field: id + range: 1-5 + - field: product + range: 1 + - field: name + range: testGit,testSvn,testHtml,testCI,testDoc + - field: path + range: /path1,/path2,/path3,/path4,/path5 + - field: SCM + range: Git{2},Gitlab{2},Subversion{1} + - field: client + range: 1 + - field: serviceHost + range: 1 + - field: serviceProject + range: 42 + - field: extra + range: 42 + - field: preMerge + range: 1 + - field: job + range: 1 + - field: deleted + range: 0