* Add switchDB by tests.

This commit is contained in:
liyang
2022-08-09 14:11:38 +08:00
parent 40ba4c8a9e
commit 3bd5ccc13f
881 changed files with 3058 additions and 1826 deletions
+2 -2
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/git.class.php';
$db->switchDB();
su('admin');
/**
@@ -11,7 +12,6 @@ cid=1
pid=1
使用正确格式的数据 >> e7699d04f1586d337f34496da932dde55db92616
使用空数据 >> 0
*/
@@ -26,4 +26,4 @@ r($git->convertLog($log)) && p('revision') && e('e7699d04f1586d337f34496da932dde
$log = array();
r($git->convertLog($log)) && p('revision') && e(0); // 使用空的数据
system("./ztest init");
$db->restoreDB();
+3 -4
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/git.class.php';
$db->switchDB();
su('admin');
/**
@@ -10,9 +11,7 @@ title=测试gitModel->getRepoLogs();
cid=1
pid=1
获取版本库的tags >> 1
使用空数据 >> 0
使用错误的版本库 >> 0
*/
@@ -30,4 +29,4 @@ $repo->client = '';
$repo->path = '';
r($git->getRepoLogs($repo)) && p() && e(0); // 使用错误的版本库
system("./ztest init");
$db->restoreDB();
+3 -1
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/git.class.php';
$db->switchDB();
su('admin');
/**
@@ -10,6 +11,7 @@ title=测试gitModel->getRepos();
cid=1
pid=1
>> id
获取版本库 >> http://10.0.1.161:51080/api/v4/projects/42/repository/
*/
@@ -19,4 +21,4 @@ $git = new gitTest();
$tester->dao->update(TABLE_REPO)->set('synced')->eq(1)->where('id')->eq(1)->exec();
r($git->getRepos()) && p() && e('http://10.0.1.161:51080/api/v4/projects/42/repository/'); // 获取版本库
system("./ztest init");
$db->restoreDB();
+3 -4
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/git.class.php';
$db->switchDB();
su('admin');
/**
@@ -10,9 +11,7 @@ title=测试gitModel->getRepoTags();
cid=1
pid=1
获取版本库的tags >> 1
使用空数据 >> 0
使用错误的版本库 >> 0
10.0.1.161:51080')->where('id')->eq(1)->exec(); >> id
*/
@@ -33,4 +32,4 @@ $repo->client = '';
$repo->path = '';
r($git->getRepoTags($repo)) && p() && e(0); // 使用错误的版本库
system("./ztest init");
$db->restoreDB();
+4 -3
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/git.class.php';
$db->switchDB();
su('admin');
/**
@@ -10,8 +11,8 @@ title=测试gitModel->setRepo();
cid=1
pid=1
设置错误版本号参数 >> ,,
设置正确版本号参数 >> 1,1,1
设置错误版本库参数 >> ,,
设置正确版本库参数 >> 1,1,1
*/
@@ -24,4 +25,4 @@ $repo = $tester->dao->select('*')->from(TABLE_REPO)->limit(1)->fetch();
if(strtolower($repo->SCM) == 'gitlab') $repo = $tester->loadModel('repo')->processGitlab($repo);
r($git->setRepo($repo)) && p("result,client,repoRoot") && e("1,1,1"); // 设置正确版本库参数
system("./ztest init");
$db->restoreDB();
+3 -2
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/git.class.php';
$db->switchDB();
su('admin');
/**
@@ -10,7 +11,7 @@ title=测试gitModel->setRepos();
cid=1
pid=1
设置版本库 >> 1
>> id
*/
@@ -18,4 +19,4 @@ $git = new gitTest();
$tester->dao->update(TABLE_REPO)->set('synced')->eq(1)->where('id')->eq(1)->exec();
r($git->setRepos()) && p('id') && e(1); // 设置版本库
system("./ztest init");
$db->restoreDB();
+3 -3
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/git.class.php';
$db->switchDB();
su('admin');
/**
@@ -10,8 +11,7 @@ title=测试gitModel->updatecommit();
cid=1
pid=1
测试正常的版本库 >> 1
测试空的版本库 >> 0
*/
@@ -24,4 +24,4 @@ r($git->updateCommit($repo)) && p() && e(1); // 测试正常的版本库
$repo = new stdclass();
r($git->updateCommit($repo)) && p() && e(0); // 测试空的版本库
system("./ztest init");
$db->restoreDB();