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:
32
tests/Feature/Cards/CardTest.php
Normal file
32
tests/Feature/Cards/CardTest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
||||
use Apoloz\AlfaBank\Core\AlfaConfig;
|
||||
use Apoloz\AlfaBank\Requests\Cards\GetCardsRequest;
|
||||
use Saloon\Http\Faking\MockResponse;
|
||||
|
||||
test('can get cards list', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
GetCardsRequest::class => MockResponse::make([
|
||||
'cards' => [
|
||||
[
|
||||
'cardId' => 'card-1',
|
||||
'maskedNumber' => '5555****4444',
|
||||
'status' => 'ACTIVE',
|
||||
'expirationDate' => '12/25',
|
||||
'paymentSystem' => 'MasterCard'
|
||||
]
|
||||
]
|
||||
], 200, ['Content-Type' => 'application/json']),
|
||||
]);
|
||||
|
||||
$config = createTestConfig();
|
||||
$connector = new AlfaBankConnector($config);
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$response = $connector->send(new GetCardsRequest());
|
||||
|
||||
expect($response->status())->toBe(200)
|
||||
->and($response->dto()->count())->toBe(1)
|
||||
->and($response->dto()->first()->cardId)->toBe('card-1');
|
||||
});
|
||||
Reference in New Issue
Block a user