225b7d9207
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
21 lines
708 B
PHP
21 lines
708 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\AdWallet;
|
|
use App\Models\Tenant;
|
|
use App\Services\Advertising\AdWalletService;
|
|
|
|
it('tops up ad wallet and writes a transaction', function () {
|
|
$tenant = Tenant::factory()->create();
|
|
AdWallet::create(['tenant_id' => $tenant->id, 'balance_rub' => '0.00', 'frozen_rub' => '0.00']);
|
|
|
|
app(AdWalletService::class)->topup($tenant->id, '1000.00', channel: null, description: 'ЮKassa');
|
|
|
|
$wallet = AdWallet::where('tenant_id', $tenant->id)->first();
|
|
expect($wallet->balance_rub)->toBe('1000.00');
|
|
$this->assertDatabaseHas('ad_wallet_transactions', [
|
|
'tenant_id' => $tenant->id, 'type' => 'topup', 'amount_rub' => '1000.00',
|
|
]);
|
|
});
|