|
38 | 38 | expect($history[0]['request']->getHeaderLine('transaction-id'))->toBe('12345678901234567890123456789012'); |
39 | 39 | }); |
40 | 40 |
|
| 41 | +it('auto-generates transaction id for account create when not provided', function (): void { |
| 42 | + $history = []; |
| 43 | + $metaapi = metaApiClientWithHistory([new Response(201, [], '{}')], $history); |
| 44 | + |
| 45 | + $metaapi->accounts()->create(['name' => 'Demo']); |
| 46 | + |
| 47 | + $transactionId = $history[0]['request']->getHeaderLine('transaction-id'); |
| 48 | + expect($transactionId)->not->toBeEmpty(); |
| 49 | + expect(strlen($transactionId))->toBe(32); |
| 50 | + expect(ctype_xdigit($transactionId))->toBeTrue(); |
| 51 | +}); |
| 52 | + |
41 | 53 | it('exposes accepted account creation retry metadata', function (): void { |
42 | 54 | $metaapi = metaApiClientWithHistory([ |
43 | 55 | new Response(202, ['Retry-After' => '10'], '{"id":"account-id","state":"DRAFT"}'), |
|
86 | 98 | expect($history[0]['request']->getHeaderLine('transaction-id'))->toBe('transaction-id'); |
87 | 99 | }); |
88 | 100 |
|
| 101 | +it('auto-generates transaction id for replica create when not provided', function (): void { |
| 102 | + $history = []; |
| 103 | + $metaapi = metaApiClientWithHistory([new Response(201, [], '{}')], $history); |
| 104 | + |
| 105 | + $metaapi->accountReplicas()->createReplica('account-id', ['magic' => 123456]); |
| 106 | + |
| 107 | + $transactionId = $history[0]['request']->getHeaderLine('transaction-id'); |
| 108 | + expect($transactionId)->not->toBeEmpty(); |
| 109 | + expect(strlen($transactionId))->toBe(32); |
| 110 | + expect(ctype_xdigit($transactionId))->toBeTrue(); |
| 111 | +}); |
| 112 | + |
89 | 113 | it('exposes accepted account replica creation retry metadata', function (): void { |
90 | 114 | $metaapi = metaApiClientWithHistory([ |
91 | 115 | new Response(202, ['Retry-After' => '15'], '{"id":"replica-id","state":"DRAFT"}'), |
|
0 commit comments