Files
portal/app/tests/Feature/Advertising/AdWalletTablesMigrationTest.php
T

36 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\Tenant;
use Illuminate\Support\Facades\DB;
it('creates ad_wallet_transactions and ad_wallet_holds', function () {
$tenant = Tenant::factory()->create();
DB::table('ad_wallet_transactions')->insert([
'tenant_id' => $tenant->id,
'type' => 'topup',
'amount_rub' => '1000.00',
'balance_rub_after' => '1000.00',
'channel' => null,
'related_type' => null,
'related_id' => null,
'description' => 'test',
'created_at' => now(),
]);
DB::table('ad_wallet_holds')->insert([
'tenant_id' => $tenant->id,
'channel' => 'yandex',
'source_type' => 'campaign',
'source_id' => 1,
'amount_rub' => '2500.00',
'status' => 'active',
'created_at' => now(),
'updated_at' => now(),
]);
expect(DB::table('ad_wallet_transactions')->where('tenant_id', $tenant->id)->count())->toBe(1)
->and(DB::table('ad_wallet_holds')->where('tenant_id', $tenant->id)->count())->toBe(1);
});