forked from apoloz/alfa-bank-sdk
refactor: dto, requests, connector
This commit is contained in:
@@ -23,3 +23,22 @@ test('can get activities dictionary', function () {
|
||||
->and($response->dto()->count())->toBe(2)
|
||||
->and($response->dto()->first()->name)->toBe('IT Services');
|
||||
});
|
||||
|
||||
test('can get regions dictionary', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
\Apoloz\AlfaBank\Requests\SelfEmployed\GetRegionsRequest::class => \Saloon\Http\Faking\MockResponse::make([
|
||||
'regions' => [['code' => '77', 'name' => 'Москва']]
|
||||
], 200),
|
||||
]);
|
||||
|
||||
$config = new \Apoloz\AlfaBank\Core\AlfaConfig('https://test.com', __DIR__ . '/../../test_cert.pem', __DIR__ . '/../../test_key.pem');
|
||||
$signer = new \Apoloz\AlfaBank\Services\OpenSslCmsSigner(__DIR__ . '/../../test_cert.pem', __DIR__ . '/../../test_key.pem');
|
||||
$connector = new \Apoloz\AlfaBank\Core\AlfaBankConnector($config, $signer);
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$response = $connector->send(new \Apoloz\AlfaBank\Requests\SelfEmployed\GetRegionsRequest());
|
||||
|
||||
expect($response->status())->toBe(200)
|
||||
->and($response->json('regions.0.name'))->toBe('Москва');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user