forked from apoloz/alfa-bank-sdk
31 lines
1005 B
PHP
31 lines
1005 B
PHP
<?php
|
|
|
|
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
|
use Apoloz\AlfaBank\Core\AlfaConfig;
|
|
use Apoloz\AlfaBank\Requests\NominalAccounts\GetNominalAccountsRequest;
|
|
use Saloon\Http\Faking\MockResponse;
|
|
|
|
test('can list nominal accounts', function (): void {
|
|
$mockClient = new \Saloon\Http\Faking\MockClient([
|
|
GetNominalAccountsRequest::class => MockResponse::make([
|
|
[
|
|
'accountNumber' => '40817810306050000000',
|
|
'isActive' => true,
|
|
],
|
|
], 200),
|
|
]);
|
|
|
|
$config = new AlfaConfig(
|
|
baseUrl: 'https://test.com',
|
|
certificatePath: __DIR__ . '/../../test_key.pem',
|
|
privateKeyPath: __DIR__ . '/../../test_key.pem'
|
|
);
|
|
$connector = new AlfaBankConnector($config);
|
|
$connector->withMockClient($mockClient);
|
|
|
|
$response = $connector->send(new GetNominalAccountsRequest);
|
|
|
|
expect($response->status())->toBe(200)
|
|
->and($response->dto()->first()->accountNumber)->toBe('40817810306050000000');
|
|
});
|