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

30 lines
1.0 KiB
PHP

<?php
use Apoloz\AlfaBank\Core\AlfaBankConnector;
use Apoloz\AlfaBank\Data\SelfEmployed\AgreementPageRequestData;
use Apoloz\AlfaBank\Requests\SelfEmployed\CreateAgreementLinkRequest;
use Saloon\Http\Faking\MockResponse;
test('can create agreement link', function (): void {
$mockClient = new \Saloon\Http\Faking\MockClient([
CreateAgreementLinkRequest::class => MockResponse::make([
'agreementPageId' => 'uuid-page-123',
'agreementPageLink' => 'https://link.alfa/...',
], 200, ['Content-Type' => 'application/json']),
]);
$config = createTestConfig();
$connector = new AlfaBankConnector($config);
$connector->withMockClient($mockClient);
$payload = new AgreementPageRequestData(
phone: '79001234567',
returnUrl: 'https://my-site.com/return'
);
$response = $connector->send(new CreateAgreementLinkRequest($payload));
expect($response->status())->toBe(200)
->and($response->json('agreementPageLink'))->toBe('https://link.alfa/...');
});