29 lines
982 B
PHP
29 lines
982 B
PHP
<?php
|
|
|
|
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
|
use Apoloz\AlfaBank\Core\AlfaConfig;
|
|
use Apoloz\AlfaBank\Services\OpenSslCmsSigner;
|
|
use Apoloz\AlfaBank\Requests\Signature\GetDistinguishedNameRequest;
|
|
use Saloon\Http\Faking\MockResponse;
|
|
use Saloon\Http\Faking\MockClient;
|
|
|
|
test('can get distinguished name', function () {
|
|
$mockClient = new MockClient([
|
|
GetDistinguishedNameRequest::class => MockResponse::make(['dn' => 'CN=Test'], 200),
|
|
]);
|
|
|
|
$config = new AlfaConfig(
|
|
baseUrl: 'https://test.com',
|
|
certificatePath: __DIR__ . '/../../test_key.pem',
|
|
privateKeyPath: __DIR__ . '/../../test_key.pem'
|
|
);
|
|
$signer = new OpenSslCmsSigner(__DIR__ . '/../../test_key.pem', __DIR__ . '/../../test_key.pem');
|
|
|
|
$connector = new AlfaBankConnector($config, $signer);
|
|
$connector->withMockClient($mockClient);
|
|
|
|
$response = $connector->send(new GetDistinguishedNameRequest());
|
|
|
|
expect($response->json('dn'))->toBe('CN=Test');
|
|
});
|