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:
49
tests/Feature/MiscellaneousTest.php
Normal file
49
tests/Feature/MiscellaneousTest.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
||||
use Apoloz\AlfaBank\Requests\Bonus\GetBonusNumbersRequest;
|
||||
use Apoloz\AlfaBank\Requests\Loans\GetCreditOffersRequest;
|
||||
use Apoloz\AlfaBank\Requests\Registries\CreateSelfEncashmentRegistryRequest;
|
||||
use Saloon\Http\Faking\MockResponse;
|
||||
|
||||
test('can get bonus numbers', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
GetBonusNumbersRequest::class => MockResponse::make(['bonusNumbers' => []], 200),
|
||||
]);
|
||||
|
||||
$config = createTestConfig();
|
||||
$connector = new AlfaBankConnector($config);
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$response = $connector->send(new GetBonusNumbersRequest());
|
||||
|
||||
expect($response->status())->toBe(200);
|
||||
});
|
||||
|
||||
test('can get credit offers', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
GetCreditOffersRequest::class => MockResponse::make(['offers' => []], 200),
|
||||
]);
|
||||
|
||||
$config = createTestConfig();
|
||||
$connector = new AlfaBankConnector($config);
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$response = $connector->send(new GetCreditOffersRequest());
|
||||
|
||||
expect($response->status())->toBe(200);
|
||||
});
|
||||
|
||||
test('can create self-encashment registry', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
CreateSelfEncashmentRegistryRequest::class => MockResponse::make([], 201),
|
||||
]);
|
||||
|
||||
$config = createTestConfig();
|
||||
$connector = new AlfaBankConnector($config);
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$response = $connector->send(new CreateSelfEncashmentRegistryRequest(new \Apoloz\AlfaBank\Data\Registries\SelfEncashmentData([])));
|
||||
|
||||
expect($response->status())->toBe(201);
|
||||
});
|
||||
Reference in New Issue
Block a user