mirror of
http://124.126.16.154:8888/singularity/hdk-pay.git
synced 2026-01-15 05:35:08 +08:00
perf: 使用更先进的 hdk 方法创建 http 请求
This commit is contained in:
@@ -11,26 +11,25 @@ declare(strict_types=1);
|
||||
*/
|
||||
|
||||
|
||||
use Singularity\HDK\Core\Service\HttpRequestService;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Singularity\HDK\Pay\Resource\Goods;
|
||||
use Singularity\HDK\Pay\Sdk\GoodsRpc;
|
||||
|
||||
/** @var GoodsRpc $service */
|
||||
$service = \Hyperf\Support\make(
|
||||
GoodsRpc::class,
|
||||
[
|
||||
'requestService' => \Hyperf\Support\make(HttpRequestService::class),
|
||||
'baseUri' => 'http://localhost:9611'
|
||||
]);
|
||||
|
||||
test('根据分类和商品名称获取到对应的 SKU', function () use ($service) {
|
||||
$goods = $service->find(
|
||||
1,
|
||||
[
|
||||
'lattice' => 'TYPE-0',
|
||||
'precision' => 'high',
|
||||
'mode' => 'gradient',
|
||||
],
|
||||
);
|
||||
expect($goods)->toBeInstanceOf(Goods::class);
|
||||
})->only();
|
||||
test(
|
||||
'根据分类和商品名称获取到对应的 SKU',
|
||||
/**
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
function () {
|
||||
$service = new GoodsRpc('http://localhost:9611');
|
||||
$goods = $service->find(
|
||||
1,
|
||||
[
|
||||
'lattice' => 'TYPE-0',
|
||||
'precision' => 'high',
|
||||
'mode' => 'gradient',
|
||||
],
|
||||
);
|
||||
expect($goods)->toBeInstanceOf(Goods::class);
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user