* Adjust svn unit test check rule.
This commit is contained in:
@@ -25,7 +25,7 @@ class Subversion
|
||||
*/
|
||||
public function __construct($client, $root, $account, $password, $encoding = 'UTF-8', $repo = null)
|
||||
{
|
||||
putenv('LC_CTYPE=en_US.UTF-8');
|
||||
putenv('LC_ALL=C');
|
||||
$this->root = str_replace(array('%3A', '%2F', '+'), array(':', '/', ' '), urlencode(rtrim($root, '/')));
|
||||
$this->account = $account;
|
||||
$this->password = $password;
|
||||
|
||||
@@ -11,6 +11,12 @@ declare(strict_types=1);
|
||||
*/
|
||||
class svnModel extends model
|
||||
{
|
||||
public function __construct(string $moduleName = '', string $methodName = '')
|
||||
{
|
||||
parent::__construct($moduleName, $methodName);
|
||||
|
||||
putenv('LC_ALL=C');
|
||||
}
|
||||
/**
|
||||
* The svn binary client.
|
||||
*
|
||||
@@ -263,7 +269,9 @@ class svnModel extends model
|
||||
{
|
||||
$cmd = $repo->client . ' --version --quiet';
|
||||
$version = `$cmd`;
|
||||
if(version_compare((string)$version, '1.6.0', '>'))
|
||||
if(!$version) return false;
|
||||
|
||||
if(version_compare($version, '1.6.0', '>'))
|
||||
{
|
||||
$this->client .= ' --trust-server-cert';
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ global $tester;
|
||||
$svn = $tester->loadModel('svn');
|
||||
|
||||
$repo = new stdclass();
|
||||
$repo->client = '/usr/bin/svn';
|
||||
$repo->client = 'svn';
|
||||
$repo->path = 'https://https-test';
|
||||
$svn->setClient($repo);
|
||||
r($svn->client) && p() && e('/usr/bin/svn --non-interactive --trust-server-cert'); // 测试https开头没有用户名密码的svn地址
|
||||
r($svn->client) && p() && e('svn --non-interactive --trust-server-cert'); // 测试https开头没有用户名密码的svn地址
|
||||
|
||||
$repo->path = 'http://https-test';
|
||||
$svn->setClient($repo);
|
||||
r($svn->client) && p() && e('/usr/bin/svn --non-interactive'); // 测试http开头没有用户名密码的svn地址
|
||||
r($svn->client) && p() && e('svn --non-interactive'); // 测试http开头没有用户名密码的svn地址
|
||||
|
||||
$repo->path = 'svn://https-test';
|
||||
$repo->account = 'test';
|
||||
$repo->path = 'svn://https-test';
|
||||
$repo->account = 'test';
|
||||
$repo->password = 'test';
|
||||
$svn->setClient($repo);
|
||||
r($svn->client) && p() && e('/usr/bin/svn --non-interactive --trust-server-cert --username test --password test --no-auth-cache'); // 测试svn开头有用户名密码的svn地址
|
||||
r($svn->client) && p() && e('svn --non-interactive --trust-server-cert --username test --password test --no-auth-cache'); // 测试svn开头有用户名密码的svn地址
|
||||
|
||||
@@ -9,7 +9,7 @@ cid=1
|
||||
|
||||
- 查询SVN仓库信息
|
||||
- 属性repoRoot @https://svn.qc.oop.cc/svn/unittest
|
||||
- 属性client @/usr/bin/svn --non-interactive --trust-server-cert --username admin --password KXdOi8zgTcUqEFX2Hx8B --no-auth-cache
|
||||
- 属性client @svn --non-interactive --trust-server-cert --username admin --password KXdOi8zgTcUqEFX2Hx8B --no-auth-cache
|
||||
|
||||
*/
|
||||
|
||||
@@ -24,4 +24,4 @@ $svn->setRepos();
|
||||
|
||||
$repo = $svn->repos[1];
|
||||
$svn->setRepo($repo);
|
||||
r($svn) && p('repoRoot,client') && e('https://svn.qc.oop.cc/svn/unittest,/usr/bin/svn --non-interactive --trust-server-cert --username admin --password KXdOi8zgTcUqEFX2Hx8B --no-auth-cache'); // 查询SVN仓库信息
|
||||
r($svn) && p('repoRoot,client') && e('https://svn.qc.oop.cc/svn/unittest,svn --non-interactive --trust-server-cert --username admin --password KXdOi8zgTcUqEFX2Hx8B --no-auth-cache'); // 查询SVN仓库信息
|
||||
|
||||
@@ -76,17 +76,22 @@ class svnTest
|
||||
$noLink = new stdclass();
|
||||
$noLink->revision = 2;
|
||||
$noLink->committer = 'test';
|
||||
$noLink->author = 'test';
|
||||
$noLink->date = '2023-01-01 00:00:00';
|
||||
$noLink->time = '2023-01-01 00:00:00';
|
||||
$noLink->msg = 'test';
|
||||
$noLink->comment = 'test';
|
||||
$noLink->change = array();
|
||||
|
||||
$linked = new stdclass();
|
||||
$linked->revision = 3;
|
||||
$linked->revision = 3;
|
||||
$linked->committer = 'test';
|
||||
$linked->time = '2023-01-02 00:00:00';
|
||||
$linked->msg = '* Code for task #1.';
|
||||
$linked->comment = '* Code for task #1.';
|
||||
$linked->author = 'test';
|
||||
$linked->date = '2023-01-02 00:00:00';
|
||||
$linked->time = '2023-01-02 00:00:00';
|
||||
$linked->msg = '* Code for task #1.';
|
||||
$linked->comment = '* Code for task #1.';
|
||||
$linked->change = array();
|
||||
if(strpos($param, 'linked') !== false) $logs[] = $linked;
|
||||
if(strpos($param, 'nolink') !== false) $logs[] = $noLink;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user