feature test su institution
This commit is contained in:
@@ -18,6 +18,7 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call([
|
||||
UserRoleSeeder::class,
|
||||
SystemUserSeeder::class,
|
||||
InstitutionCategorySeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
33
backend/database/seeders/InstitutionCategorySeeder.php
Normal file
33
backend/database/seeders/InstitutionCategorySeeder.php
Normal 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],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user