correcao do seeder
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-09-30 13:57:28 +02:00
parent cbae1ce77b
commit a6afb4e97a
@@ -134,18 +134,20 @@ class TerritoryReferenceSeeder extends Seeder
}
$type = $record['location_type'];
$expectedParent = [
$parentTypes = [
'country' => null,
'province' => 'country',
'district' => 'province',
'admin_post' => 'district',
'locality' => 'admin_post',
][$type] ?? false;
];
if ($expectedParent === false || isset($seen[$record['id']])) {
if (! array_key_exists($type, $parentTypes) || isset($seen[$record['id']])) {
throw new RuntimeException('Territory reference has an invalid type or duplicate ID.');
}
$expectedParent = $parentTypes[$type];
if ($expectedParent === null) {
if ($record['parent_id'] !== null) {
throw new RuntimeException('Country reference cannot have a parent.');