+ Add the test file of storeModel::getAppMapByNames.

This commit is contained in:
xieqiyu
2023-12-29 13:52:58 +08:00
parent 5b09d7a14d
commit 700d9315b7
2 changed files with 41 additions and 0 deletions
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);
/**
title=测试 storeModel->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
+15
View File
@@ -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;
}
}