Merge branch 'master' into zenops_46
This commit is contained in:
@@ -194,7 +194,7 @@ class repoTest
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
return !empty($objects) ? array_keys($objects) : 'empty';
|
||||
}
|
||||
|
||||
public function getGitRevisionNameTest($revision, $commit)
|
||||
@@ -386,13 +386,17 @@ class repoTest
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function addLinkTest($matches, $method)
|
||||
public function addLinkTest($comment, $type)
|
||||
{
|
||||
$objects = $this->objectModel->addLink($matches, $method);
|
||||
$rules = $this->objectModel->processRules();
|
||||
$objectReg = '/' . $rules[$type . 'Reg'] . '/i';
|
||||
if(preg_match_all($objectReg, $comment, $result))
|
||||
{
|
||||
$links = $this->objectModel->addLink($result, $type);
|
||||
foreach($links as $link) return $link;
|
||||
}
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
return 'empty';
|
||||
}
|
||||
|
||||
public function parseCommentTest($comment)
|
||||
|
||||
@@ -14,4 +14,11 @@ pid=1
|
||||
|
||||
$repo = new repoTest();
|
||||
|
||||
r($repo->addLinkTest()) && p() && e();
|
||||
$commentTask = 'Finish task #1.';
|
||||
$commentStory = 'Effort story #1 Cost 1h.';
|
||||
$commentBug = 'Fix bug #1.';
|
||||
$commentElse = 'Anything else.';
|
||||
r($repo->addLinkTest($commentTask, 'task')) && p('') && e("task #<a href='atask-view-1.' >1</a>"); //任务链接
|
||||
r($repo->addLinkTest($commentStory, 'story')) && p('') && e("story #<a href='astory-view-1.' >1</a>"); //需求链接
|
||||
r($repo->addLinkTest($commentBug, 'bug')) && p('') && e("bug #<a href='abug-view-1.' >1</a>"); //Bug链接
|
||||
r($repo->addLinkTest($commentElse, 'task')) && p('') && e("empty"); //无链接
|
||||
|
||||
@@ -12,6 +12,22 @@ pid=1
|
||||
|
||||
*/
|
||||
|
||||
$repo = new repoTest();
|
||||
global $tester, $dao;
|
||||
$repo = $tester->loadModel('repo')->getRepoByID(1);
|
||||
$logs = $tester->repo->getUnsyncedCommits($repo);
|
||||
$revision = 1;
|
||||
$revisions = array();
|
||||
foreach($logs as $log)
|
||||
{
|
||||
$tester->repo->saveOneCommit($repo->id, $log, $revision);
|
||||
$revisions[] = $log->revision;
|
||||
$revision ++;
|
||||
}
|
||||
|
||||
r($repo->getHistoryTest()) && p() && e();
|
||||
$repoTest = new repoTest();
|
||||
|
||||
r($repoTest->getHistoryTest(1, $revisions)) && p('1') && e('d5789b703dc09c44be1e89a991c3506de1f678e3'); //查询全部提交信息
|
||||
r($repoTest->getHistoryTest(1, array())) && p('') && e('empty'); //传空数据查询信息
|
||||
|
||||
$dao->exec('truncate table zt_repohistory');
|
||||
$dao->exec('truncate table zt_repobranch');
|
||||
|
||||
Reference in New Issue
Block a user