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

41 lines
1.4 KiB
PHP
Raw Normal View History

<?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);
});