* Add unitcase.
This commit is contained in:
@@ -375,9 +375,12 @@ class apiModel extends model
|
||||
public function getApiListByRelease($release, $where = '1 = 1 ')
|
||||
{
|
||||
$strJoin = array();
|
||||
foreach($release->snap['apis'] as $api)
|
||||
if(isset($release->snap['apis']))
|
||||
{
|
||||
$strJoin[] = "(spec.doc = {$api['id']} and spec.version = {$api['version']} )";
|
||||
foreach($release->snap['apis'] as $api)
|
||||
{
|
||||
$strJoin[] = "(spec.doc = {$api['id']} and spec.version = {$api['version']} )";
|
||||
}
|
||||
}
|
||||
|
||||
if($strJoin) $where .= 'and (' . implode(' or ', $strJoin) . ')';
|
||||
@@ -404,7 +407,7 @@ class apiModel extends model
|
||||
$rel = $this->getRelease(0, 'byId', $release);
|
||||
|
||||
$where = "1=1 and lib = $libID ";
|
||||
if($moduleID > 0)
|
||||
if($moduleID > 0 and isset($rel->snap['modules']))
|
||||
{
|
||||
$sub = array();
|
||||
foreach($rel->snap['modules'] as $module)
|
||||
|
||||
@@ -152,13 +152,22 @@ class apiTest
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list by module ID.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $moduleID
|
||||
* @param int $release
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getListByModuleIdTest($libID = 0, $moduleID = 0, $release = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getListByModuleId($libID = 0, $moduleID = 0, $release = 0);
|
||||
$objects = $this->objectModel->getListByModuleId($libID, $moduleID, $release);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
return current($objects);
|
||||
}
|
||||
|
||||
public function getStructByQueryTest($libID, $pager = '', $orderBy = '')
|
||||
|
||||
@@ -14,4 +14,7 @@ pid=1
|
||||
|
||||
$api = new apiTest();
|
||||
|
||||
r($api->getListByModuleIdTest()) && p() && e();
|
||||
r($api->getListByModuleIdTest(1, 1, 1)) && p('title') && e('获取token'); //通过正常的libID、moduleID、releaseID查询api信息
|
||||
r($api->getListByModuleIdTest(1, 1, 0)) && p('title') && e('获取我的个人信息'); //通过正常的libID、moduleID,不传releaseID,查询api信息
|
||||
r($api->getListByModuleIdTest(1, 0, 0)) && p('title') && e('获取token'); //通过正常的libID,不传moduleID、releaseID查询api信息
|
||||
r($api->getListByModuleIdTest(0, 0, 0)) && p('title') && e('0'); //通过不存在的libID,moduleID,releaseID查询api信息
|
||||
|
||||
Reference in New Issue
Block a user