diff --git a/module/cne/test/cne.class.php b/module/cne/test/cne.class.php index aa2b2d559c..b155571fb3 100644 --- a/module/cne/test/cne.class.php +++ b/module/cne/test/cne.class.php @@ -235,4 +235,18 @@ class cneTest return $this->objectModel->batchQueryStatus($instances); } + + /** + * Test appDBList method. + * + * @param int $instanceID + * @access public + * @return array + */ + public function appDBListTest(int $instanceID): array + { + $instance = $this->objectModel->loadModel('instance')->getByID($instanceID); + + return $this->objectModel->appDBList($instance); + } } diff --git a/module/cne/test/model/appdblist.php b/module/cne/test/model/appdblist.php new file mode 100755 index 0000000000..8e9794ab9c --- /dev/null +++ b/module/cne/test/model/appdblist.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +appDBList(); +timeout=0 +cid=1 + +- 获取第一个应用的数据库信息 + - 第gitlab-20231226133115-gitlabhq-production条的db_type属性 @postgresql + - 第gitlab-20231226133115-gitlabhq-production条的db_name属性 @gitlabhq_production +- 获取第二个应用的数据库信息 @0 + +*/ + +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/cne.class.php'; + +zdTable('space')->config('space')->gen(2); +zdTable('solution')->config('solution')->gen(1); +zdTable('instance')->config('instance')->gen(2, true, false); + +$cneModel = new cneTest(); +r($cneModel->appDBListTest(1)) && p('gitlab-20231226133115-gitlabhq-production:db_type,db_name') && e('postgresql,gitlabhq_production'); // 获取第一个应用的数据库信息 +r($cneModel->appDBListTest(2)) && p() && e('0'); // 获取第二个应用的数据库信息 \ No newline at end of file