diff --git a/app/app/Services/Supplier/Import/SupplierImportMapper.php b/app/app/Services/Supplier/Import/SupplierImportMapper.php index 62811639..ebac2aaf 100644 --- a/app/app/Services/Supplier/Import/SupplierImportMapper.php +++ b/app/app/Services/Supplier/Import/SupplierImportMapper.php @@ -42,7 +42,7 @@ final class SupplierImportMapper return []; } - return array_values(array_map(static fn (string $p): int => (int) $p, $parts)); + return array_map(static fn (string $p): int => (int) $p, $parts); } /** diff --git a/app/app/Services/Supplier/Import/SupplierProjectImporter.php b/app/app/Services/Supplier/Import/SupplierProjectImporter.php index 2b7bb1c9..79083581 100644 --- a/app/app/Services/Supplier/Import/SupplierProjectImporter.php +++ b/app/app/Services/Supplier/Import/SupplierProjectImporter.php @@ -141,7 +141,7 @@ class SupplierProjectImporter $planned[] = $g; } - return ['planned' => array_values($planned), 'skipped' => $skipped]; + return ['planned' => $planned, 'skipped' => $skipped]; } /** @@ -277,7 +277,7 @@ class SupplierProjectImporter */ private function projectExists(int $tenantId, array $group): bool { - $query = \App\Models\Project::on('pgsql_supplier') + $query = Project::on('pgsql_supplier') ->where('tenant_id', $tenantId) ->where('signal_type', $group['signal_type']); diff --git a/app/tests/Unit/Supplier/SupplierImportMapperTest.php b/app/tests/Unit/Supplier/SupplierImportMapperTest.php index d8eeb018..f6977cf4 100644 --- a/app/tests/Unit/Supplier/SupplierImportMapperTest.php +++ b/app/tests/Unit/Supplier/SupplierImportMapperTest.php @@ -3,8 +3,9 @@ declare(strict_types=1); use App\Services\Supplier\Import\SupplierImportMapper; +use Tests\TestCase; -uses(Tests\TestCase::class); +uses(TestCase::class); test('platformFromSrc maps rt/bl/mt to B1/B2/B3, others null', function (): void { expect(SupplierImportMapper::platformFromSrc('rt'))->toBe('B1'); diff --git a/app/tests/Unit/Supplier/SupplierRegionsTest.php b/app/tests/Unit/Supplier/SupplierRegionsTest.php index ba04c5a6..0cb601b2 100644 --- a/app/tests/Unit/Supplier/SupplierRegionsTest.php +++ b/app/tests/Unit/Supplier/SupplierRegionsTest.php @@ -50,20 +50,20 @@ it('every map entry points to a distinct supplier code (no collisions)', functio test('mapFromSupplier inverts LIDERRA_TO_SUPPLIER bijection', function (): void { // ГИБДД 24 → Лидерра 29 (Красноярский); ГИБДД 77 → Лидерра 82 (Москва) - expect(\App\Support\SupplierRegions::mapFromSupplier([24]))->toBe([29]); - expect(\App\Support\SupplierRegions::mapFromSupplier([77]))->toBe([82]); + expect(SupplierRegions::mapFromSupplier([24]))->toBe([29]); + expect(SupplierRegions::mapFromSupplier([77]))->toBe([82]); }); test('mapFromSupplier maps multiple codes, sorted ascending, deduped', function (): void { // ГИБДД 77→82 (Москва), 78→83 (СПб), 24→29 (Красноярский) - expect(\App\Support\SupplierRegions::mapFromSupplier([78, 24, 77, 24]))->toBe([29, 82, 83]); + expect(SupplierRegions::mapFromSupplier([78, 24, 77, 24]))->toBe([29, 82, 83]); }); test('mapFromSupplier drops unknown supplier codes', function (): void { // 999 нет в карте → отброшен; 24 → 29 - expect(\App\Support\SupplierRegions::mapFromSupplier([999, 24]))->toBe([29]); + expect(SupplierRegions::mapFromSupplier([999, 24]))->toBe([29]); }); test('mapFromSupplier returns [] for empty input', function (): void { - expect(\App\Support\SupplierRegions::mapFromSupplier([]))->toBe([]); + expect(SupplierRegions::mapFromSupplier([]))->toBe([]); });