diff --git a/module/cne/test/cne.class.php b/module/cne/test/cne.class.php index e11781e6d2..f160abf213 100644 --- a/module/cne/test/cne.class.php +++ b/module/cne/test/cne.class.php @@ -176,4 +176,22 @@ class cneTest return $result; } + + /** + * Test getSettingsMapping method. + * + * @param array $maps + * @access public + * @return object|null + */ + public function getSettingsMappingTest(array $maps = array()): object|null + { + $this->objectModel->error = new stdclass(); + $instance = $this->objectModel->loadModel('instance')->getByID(1); + + $result = $this->objectModel->getSettingsMapping($instance, $maps); + if(!empty($this->objectModel->error->message)) return $this->objectModel->error; + + return $result; + } } diff --git a/module/cne/test/model/getsettingsmapping.php b/module/cne/test/model/getsettingsmapping.php new file mode 100755 index 0000000000..1e4a098eaa --- /dev/null +++ b/module/cne/test/model/getsettingsmapping.php @@ -0,0 +1,42 @@ +#!/usr/bin/env php +getSettingsMapping(); +timeout=0 +cid=1 + +- 获取管理员账号信息 + - 属性admin_username @root + - 属性z_username @zentao-bot +- 获取管理员账号信息 + - 属性admin_username @~~ + - 属性z_username @zentao-bot + +*/ + +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->getSettingsMappingTest()) && p('admin_username,z_username') && e('root,zentao-bot'); // 获取管理员账号信息 + +$maps = array( + array( + "key" => "z_username", + "path" => "z_username", + "type" => "secret" + ), + array( + "key" => "z_password", + "path" => "z_password", + "type" => "secret" + ) +); +r($cneModel->getSettingsMappingTest($maps)) && p('admin_username,z_username') && e('~~,zentao-bot'); // 获取管理员账号信息 \ No newline at end of file