Files
portal/app/tests/Feature/Advertising/AdCampaignMigrationTest.php
T
Дмитрий 27ab44ba37 refactor(реклама показы): удалён мёртвый клик-код клиента Директа и легаси-поля модели
Задача 8c. После перевода запуска на медийную кампанию за показы удалены
неиспользуемые методы клиента YandexDirectClient: addCampaign TextCampaign,
addAdGroup, addAudienceTarget с ContextBid, addTextAd прод-вызовов нет.
Из модели AdCampaign убраны легаси клик-поля weekly_budget_rub и click_bid_rub
из fillable и casts колонки в БД не тронуты.

uploadAdImage и текстовые объявления оставлены живыми они ещё используются.
Тесты клиента и модели обновлены. Реклама-модуль 188/188 зелёный.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-27 08:48:08 +03:00

41 lines
1.4 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,
'daily_budget_rub' => null,
'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((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);
});