mirror of
http://124.126.16.154:8888/singularity/hdk-pay.git
synced 2026-01-15 05:35:08 +08:00
feat: 初步实现了获取单个商品的方法
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Example;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Example\Greeting;
|
||||
|
||||
class GreetingTest extends TestCase
|
||||
{
|
||||
public function testItGreetsUser(): void
|
||||
{
|
||||
$greeting = new Greeting('Rasmus Lerdorf');
|
||||
|
||||
$this->assertSame('Hello Rasmus Lerdorf', $greeting->sayHello());
|
||||
}
|
||||
}
|
||||
36
tests/Unit/GoodsTest.php
Normal file
36
tests/Unit/GoodsTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* GoodsTest.php@LuxPay
|
||||
*
|
||||
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
|
||||
* Powered by PhpStorm
|
||||
* Created on 2023/7/18
|
||||
*/
|
||||
|
||||
|
||||
use Singularity\HDK\Core\Service\HttpRequestService;
|
||||
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();
|
||||
Reference in New Issue
Block a user