forked from apoloz/alfa-bank-sdk
26 lines
880 B
PHP
26 lines
880 B
PHP
<?php
|
|
|
|
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
|
use Apoloz\AlfaBank\Core\AlfaConfig;
|
|
use Apoloz\AlfaBank\Requests\SelfEmployed\GetActivitiesRequest;
|
|
use Saloon\Http\Faking\MockResponse;
|
|
|
|
test('can get activities dictionary', function () {
|
|
$mockClient = new \Saloon\Http\Faking\MockClient([
|
|
GetActivitiesRequest::class => MockResponse::make([
|
|
['id' => '1', 'name' => 'IT Services'],
|
|
['id' => '2', 'name' => 'Design'],
|
|
], 200, ['Content-Type' => 'application/json']),
|
|
]);
|
|
|
|
$config = createTestConfig();
|
|
$connector = new AlfaBankConnector($config);
|
|
$connector->withMockClient($mockClient);
|
|
|
|
$response = $connector->send(new GetActivitiesRequest());
|
|
|
|
expect($response->status())->toBe(200)
|
|
->and($response->dto()->count())->toBe(2)
|
|
->and($response->dto()->first()->name)->toBe('IT Services');
|
|
});
|