b1f58ec14b
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Tenant;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
it('creates ad_campaigns with draft defaults and stores yandex ids', function () {
|
|
$tenant = Tenant::factory()->create();
|
|
|
|
DB::table('ad_campaigns')->insert([
|
|
'tenant_id' => $tenant->id,
|
|
'channel' => 'yandex',
|
|
'name' => 'Кампания №1',
|
|
'status' => 'draft',
|
|
'audience_days' => 10,
|
|
'use_uploaded_list' => false,
|
|
'weekly_budget_rub' => '2500.00',
|
|
'daily_budget_rub' => null,
|
|
'click_bid_rub' => '10.00',
|
|
'yandex_segment_id' => 58034825,
|
|
'yandex_retargeting_list_id' => 777,
|
|
'yandex_campaign_id' => 111222,
|
|
'yandex_ad_group_id' => 333444,
|
|
'moderation_reason' => null,
|
|
'launched_at' => null,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
]);
|
|
|
|
$row = DB::table('ad_campaigns')->where('tenant_id', $tenant->id)->first();
|
|
|
|
expect($row->channel)->toBe('yandex')
|
|
->and($row->name)->toBe('Кампания №1')
|
|
->and($row->status)->toBe('draft')
|
|
->and((int) $row->audience_days)->toBe(10)
|
|
->and((bool) $row->use_uploaded_list)->toBeFalse()
|
|
->and($row->weekly_budget_rub)->toBe('2500.00')
|
|
->and($row->click_bid_rub)->toBe('10.00')
|
|
->and((int) $row->yandex_segment_id)->toBe(58034825)
|
|
->and((int) $row->yandex_retargeting_list_id)->toBe(777)
|
|
->and((int) $row->yandex_campaign_id)->toBe(111222)
|
|
->and((int) $row->yandex_ad_group_id)->toBe(333444);
|
|
});
|