c661b99097
8 таблиц client_sms_* (6 tenant-RLS + 2 глобальных тарифы/настройки), политики tenant_isolation по образцу ad_wallets, гранты crm_app_user / crm_admin_user (гварды ролей). Модели ядра + сид ступеней и настроек. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
73 lines
2.7 KiB
PHP
73 lines
2.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('creates client_sms_campaigns with expected columns', function () {
|
|
expect(Schema::hasTable('client_sms_campaigns'))->toBeTrue();
|
|
expect(Schema::hasColumns('client_sms_campaigns', [
|
|
'tenant_id', 'title', 'body', 'sender_name', 'source', 'audience_days',
|
|
'status', 'segments', 'planned_count', 'sent_count', 'total_sms',
|
|
'price_rub_per_sms', 'estimated_cost_rub', 'actual_cost_rub', 'created_by',
|
|
]))->toBeTrue();
|
|
});
|
|
|
|
it('creates client_sms_campaign_phones with expected columns', function () {
|
|
expect(Schema::hasTable('client_sms_campaign_phones'))->toBeTrue();
|
|
expect(Schema::hasColumns('client_sms_campaign_phones', [
|
|
'tenant_id', 'campaign_id', 'phone', 'expires_at',
|
|
]))->toBeTrue();
|
|
});
|
|
|
|
it('creates client_sms_messages with expected columns', function () {
|
|
expect(Schema::hasTable('client_sms_messages'))->toBeTrue();
|
|
expect(Schema::hasColumns('client_sms_messages', [
|
|
'tenant_id', 'campaign_id', 'deal_id', 'phone', 'operator', 'provider_key',
|
|
'status', 'cost_rub', 'provider_message_id', 'error',
|
|
]))->toBeTrue();
|
|
});
|
|
|
|
it('creates client_sms_optouts with expected columns', function () {
|
|
expect(Schema::hasTable('client_sms_optouts'))->toBeTrue();
|
|
expect(Schema::hasColumns('client_sms_optouts', [
|
|
'tenant_id', 'phone',
|
|
]))->toBeTrue();
|
|
});
|
|
|
|
it('creates client_sms_contacts with expected columns', function () {
|
|
expect(Schema::hasTable('client_sms_contacts'))->toBeTrue();
|
|
expect(Schema::hasColumns('client_sms_contacts', [
|
|
'tenant_id', 'phone', 'name', 'operator',
|
|
]))->toBeTrue();
|
|
});
|
|
|
|
it('creates client_sms_templates with expected columns', function () {
|
|
expect(Schema::hasTable('client_sms_templates'))->toBeTrue();
|
|
expect(Schema::hasColumns('client_sms_templates', [
|
|
'tenant_id', 'title', 'body',
|
|
]))->toBeTrue();
|
|
});
|
|
|
|
it('creates client_sms_tariffs with expected columns and seeds exactly 5 rows', function () {
|
|
expect(Schema::hasTable('client_sms_tariffs'))->toBeTrue();
|
|
expect(Schema::hasColumns('client_sms_tariffs', [
|
|
'min_qty', 'price_rub',
|
|
]))->toBeTrue();
|
|
|
|
expect(DB::table('client_sms_tariffs')->count())->toBe(5);
|
|
});
|
|
|
|
it('creates client_sms_settings with expected columns and seeds exactly 1 row', function () {
|
|
expect(Schema::hasTable('client_sms_settings'))->toBeTrue();
|
|
expect(Schema::hasColumns('client_sms_settings', [
|
|
'name_fee_rub_per_operator', 'name_debt_grace_days',
|
|
]))->toBeTrue();
|
|
|
|
expect(DB::table('client_sms_settings')->count())->toBe(1);
|
|
});
|