feat(import): сервис StatusRuToSlugMapper (ТЗ §6.4)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Дмитрий
2026-05-16 17:42:49 +03:00
parent ef4df2925f
commit 424987bedb
2 changed files with 73 additions and 0 deletions
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
use App\Services\Import\StatusRuToSlugMapper;
test('маппит все 14 канонических статусов §6.4', function (): void {
$mapper = new StatusRuToSlugMapper;
expect($mapper->toSlug('Новые'))->toBe('new')
->and($mapper->toSlug('Оплачено'))->toBe('paid')
->and($mapper->toSlug('Конечный недозвон'))->toBe('final_missed')
->and($mapper->map())->toHaveCount(14);
});
test('тримит пробелы вокруг значения', function (): void {
expect((new StatusRuToSlugMapper)->toSlug(' Переговоры '))->toBe('negotiations');
});
test('возвращает null для неизвестного статуса', function (): void {
expect((new StatusRuToSlugMapper)->toSlug('Архив'))->toBeNull()
->and((new StatusRuToSlugMapper)->toSlug(''))->toBeNull();
});