88ace4e3d9
Accessibility (Pa11y live) / a11y (push) Has been cancelled
Снижение остатка 19 to 5. Всё тест-сторона: - PdErasureServiceTest + AdminPdSubjectRequestsControllerTest: SharesSupplierPdo — перестали коммитить pd_processing_log через pgsql_supplier, что ломало глобальный audit:verify-chains (6 падений) и амплифицировало PhoneRegionSmoke. - ReportFileDeletePdLogTest: SharesSupplierPdo — cron reports:cleanup-expired теперь видит незакоммиченные job'ы теста. - AdminSuppliersControllerTest: устойчивый ассерт (с фазы 3 в suppliers есть direct). - AuthLogCoverageTest/AuthFlowIntegrationTest: новый флоу самозаписи G1/SP1 — register_success пишется после confirm-email; добавлен шаг подтверждения. - ImpersonationTest end: verify (G7-B) ставит маркер impersonation → admin-зона закрыта by design; помечаем токен used напрямую вместо session-takeover. - CleanupInactiveSupplierProjectsJobTest: phase A читает pivot project_supplier_links — добавлена привязка linkProjectToSupplier (раньше был только legacy FK). - Pint-нормализация uses() FQN to import в ранее тронутых файлах. Остаток 5 (НЕ слепой патч): webhook B-префикс ×2 (решение владельца), advisory-lock audit-цепочки (возможный дрейф схемы, флажок), SupplierConnection WARN#2 (cap-3, поведенческое), SupplierPortalClientTest (пре-существующий, не от этих правок). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
52 lines
1.9 KiB
PHP
52 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Project;
|
|
use App\Models\Tenant;
|
|
use App\Services\Project\ProjectService;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
|
use Illuminate\Support\Facades\Queue;
|
|
|
|
uses(DatabaseTransactions::class);
|
|
|
|
beforeEach(function () {
|
|
Queue::fake();
|
|
$this->tenant = Tenant::factory()->create(['balance_leads' => 100]);
|
|
});
|
|
|
|
function makeCall(array $over = []): array
|
|
{
|
|
return array_merge([
|
|
'name' => 'Проект A', 'signal_type' => 'call', 'signal_identifier' => '79991110000',
|
|
'daily_limit_target' => 5, 'regions' => [], 'delivery_days_mask' => 31,
|
|
], $over);
|
|
}
|
|
|
|
it('blocks duplicate source within tenant with human message', function () {
|
|
app(ProjectService::class)->create($this->tenant, makeCall());
|
|
expect(fn () => app(ProjectService::class)
|
|
->create($this->tenant, makeCall(['name' => 'Проект B'])))
|
|
->toThrow(HttpResponseException::class);
|
|
});
|
|
|
|
it('allows same source for a different tenant (sharing)', function () {
|
|
$other = Tenant::factory()->create(['balance_leads' => 100]);
|
|
app(ProjectService::class)->create($this->tenant, makeCall());
|
|
$p = app(ProjectService::class)->create($other, makeCall(['name' => 'Проект B']));
|
|
expect($p)->toBeInstanceOf(Project::class);
|
|
});
|
|
|
|
it('blocks duplicate name within tenant with human message (not SQL)', function () {
|
|
app(ProjectService::class)->create($this->tenant, makeCall());
|
|
try {
|
|
app(ProjectService::class)
|
|
->create($this->tenant, makeCall(['name' => 'Проект A', 'signal_identifier' => '79992220000']));
|
|
$this->fail('expected HttpResponseException');
|
|
} catch (HttpResponseException $e) {
|
|
$body = $e->getResponse()->getData(true);
|
|
expect($body['errors']['name'][0] ?? '')->not->toContain('SQLSTATE');
|
|
}
|
|
});
|