Merge branch 'dht.unittest' into 'master'
Add repo unittest. See merge request easycorp/zentaopms!5698
This commit is contained in:
@@ -50,20 +50,34 @@ class repoTest
|
||||
|
||||
public function getListTest($projectID = 0, $SCM = '', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getList($projectID, $SCM, $orderBy, $pager);
|
||||
$objects = $this->objectModel->getList($projectID , $SCM, $orderBy , $pager );
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
if(!empty($objects))
|
||||
{
|
||||
return $objects[1]->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'empty';
|
||||
}
|
||||
}
|
||||
|
||||
public function getListBySCMTest($scm, $type = 'all')
|
||||
{
|
||||
$objects = $this->objectModel->getListBySCM($scm, $type);
|
||||
$objects = $this->objectModel->getListBySCM($scm, $type = 'all');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
if(!empty($objects))
|
||||
{
|
||||
return $objects[0]->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'empty';
|
||||
}
|
||||
}
|
||||
|
||||
public function createTest($list)
|
||||
|
||||
@@ -13,5 +13,18 @@ pid=1
|
||||
*/
|
||||
|
||||
$repo = new repoTest();
|
||||
$result1 = $repo->getCloneUrlTest(1);
|
||||
$result2 = $repo->getCloneUrlTest(2);
|
||||
$result3 = $repo->getCloneUrlTest(3);
|
||||
$result4 = $repo->getCloneUrlTest(4);
|
||||
$result5 = $repo->getCloneUrlTest(7);
|
||||
$result6 = $repo->getCloneUrlTest(11);
|
||||
$result7 = $repo->getCloneUrlTest(0);
|
||||
|
||||
r($repo->getCloneUrlTest()) && p() && e();
|
||||
r($result1) && p('http') && e('');
|
||||
r($result2) && p('http') && e('');
|
||||
r($result3) && p('http') && e('');
|
||||
r($result4) && p('http') && e('');
|
||||
r($result5) && p('http') && e('');
|
||||
r($result6) && p('http') && e('');
|
||||
r($result7) && p('http') && e('');
|
||||
|
||||
@@ -13,5 +13,10 @@ pid=1
|
||||
*/
|
||||
|
||||
$repo = new repoTest();
|
||||
$result1 = $repo->getListBySCMTest('Gitlab');
|
||||
$result2 = $repo->getListBySCMTest('gogs');
|
||||
$result3 = $repo->getListBySCMTest('empty');
|
||||
|
||||
r($repo->getListBySCMTest()) && p() && e();
|
||||
r($result1) && p('') && e('723test');
|
||||
r($result2) && p('') && e('empty');
|
||||
r($result3) && p('') && e('empty');
|
||||
|
||||
Reference in New Issue
Block a user