forked from apoloz/alfa-bank-sdk
refactor(core): enhance SDK structure and documentation
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
40
tests/Feature/Escrow/EscrowTest.php
Normal file
40
tests/Feature/Escrow/EscrowTest.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
||||
use Apoloz\AlfaBank\Requests\Escrow\GetBuildProjectsRequest;
|
||||
use Apoloz\AlfaBank\Requests\Escrow\GetEscrowOrdersRequest;
|
||||
use Saloon\Http\Faking\MockResponse;
|
||||
|
||||
test('can get build projects', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
GetBuildProjectsRequest::class => MockResponse::make([
|
||||
['projectNumber' => '123', 'commercialName' => 'ЖК Тест']
|
||||
], 200),
|
||||
]);
|
||||
|
||||
$config = createTestConfig();
|
||||
$connector = new AlfaBankConnector($config);
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$response = $connector->send(new GetBuildProjectsRequest());
|
||||
|
||||
expect($response->status())->toBe(200)
|
||||
->and($response->json())->toBeArray()
|
||||
->and($response->json('0.projectNumber'))->toBe('123');
|
||||
});
|
||||
|
||||
test('can get escrow orders', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
GetEscrowOrdersRequest::class => MockResponse::make([
|
||||
'orders' => []
|
||||
], 200),
|
||||
]);
|
||||
|
||||
$config = createTestConfig();
|
||||
$connector = new AlfaBankConnector($config);
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$response = $connector->send(new GetEscrowOrdersRequest('2023-01-01', '2023-12-31'));
|
||||
|
||||
expect($response->status())->toBe(200);
|
||||
});
|
||||
Reference in New Issue
Block a user