feature test su institution

This commit is contained in:
Giuseppe Naponiello
2026-06-22 22:14:15 +02:00
parent cc4e174880
commit fe73662903
39 changed files with 2432 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ class DatabaseSeeder extends Seeder
$this->call([
UserRoleSeeder::class,
SystemUserSeeder::class,
InstitutionCategorySeeder::class,
]);
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Database\Seeders;
use App\Models\Lists\InstitutionCategory;
use Illuminate\Database\Seeder;
class InstitutionCategorySeeder extends Seeder
{
/**
* Categorie di istituzione. Idempotente.
*
* Gli id sono FISSI e coincidono con il DB legacy (v1) così l'ETL mappa
* institutions.category_id 1:1 senza tradurre. La categoria 1 ("uncategorized",
* mai usata) e la 5 (inesistente nel legacy) sono volutamente assenti.
*/
public function run(): void
{
$categories = [
2 => InstitutionCategory::LIBRARY,
3 => InstitutionCategory::MUSEUM,
4 => InstitutionCategory::PUBLIC_ADMINISTRATION,
6 => InstitutionCategory::RESEARCH_INSTITUTE,
];
foreach ($categories as $id => $value) {
InstitutionCategory::updateOrCreate(
['id' => $id],
['value' => $value],
);
}
}
}