Files
alfa-bank-sdk/tests/Feature/Cards/CardTest.php
Anatoliy Poloz b15d29f8e9 fix(formating)
2026-01-28 03:36:26 +03:00

32 lines
1.0 KiB
PHP

<?php
use Apoloz\AlfaBank\Core\AlfaBankConnector;
use Apoloz\AlfaBank\Requests\Cards\GetCardsRequest;
use Saloon\Http\Faking\MockResponse;
test('can get cards list', function (): void {
$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');
});