From 700d9315b7ac72bcaeec509b6100ebcbe0150f85 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Fri, 29 Dec 2023 13:52:17 +0800 Subject: [PATCH] + Add the test file of storeModel::getAppMapByNames. --- module/store/test/model/getappmapbynames.php | 26 ++++++++++++++++++++ module/store/test/store.class.php | 15 +++++++++++ 2 files changed, 41 insertions(+) create mode 100644 module/store/test/model/getappmapbynames.php diff --git a/module/store/test/model/getappmapbynames.php b/module/store/test/model/getappmapbynames.php new file mode 100644 index 0000000000..f7c257d2d7 --- /dev/null +++ b/module/store/test/model/getappmapbynames.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getAppMapByNames(). +cid=1 + +- 测试传入查询名称为空 @0 +- 测试查询名称为adminer和zentao + - 第adminer条的name属性 @adminer + - 第zentao条的name属性 @zentao + +*/ + +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/store.class.php'; + +zdTable('user')->gen(5); +su('admin'); + +$nameList = array(array(), array('adminer', 'zentao')); + +$store = new storeTest(); +r($store->getAppMapByNamesTest($nameList[0])) && p() && e('0'); //测试传入查询名称为空 +r($store->getAppMapByNamesTest($nameList[1])) && p('adminer:name;zentao:name') && e('adminer;zentao'); //测试查询名称为adminer和zentao diff --git a/module/store/test/store.class.php b/module/store/test/store.class.php index da5d6bc828..d9b3cc759e 100644 --- a/module/store/test/store.class.php +++ b/module/store/test/store.class.php @@ -79,4 +79,19 @@ class storeTest { return $this->getAppInfo($appID, $analysis, $name, $version, $channel); } + + /** + * 测试根据名称查询多个应用信息。 + * Test get app infos map by name array from cloud market. + * + * @param array $nameList + * @param string $channel + * @access public + * @return object|null + */ + public function getAppMapByNamesTest(array $nameList = array()): object|null + { + $result = $this->getAppMapByNames($nameList); + return empty((array)$result) ? null : $result; + } }