Pruebas de integracion con seeds
This commit is contained in:
39
app/tests/extension/Seeds/Inmobiliarias.php
Normal file
39
app/tests/extension/Seeds/Inmobiliarias.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace Tests\Extension\Seeds;
|
||||
|
||||
use Tests\Extension\AbstractSeed;
|
||||
|
||||
class Inmobiliarias extends AbstractSeed
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$tipos = $this->loadValues('tipo_sociedad', columns: 'id');
|
||||
$suffixes = [
|
||||
'Inmobiliaria ',
|
||||
'Administradora ',
|
||||
'Asesorías ',
|
||||
''
|
||||
];
|
||||
|
||||
$n = 5;
|
||||
$data = [];
|
||||
for ($i = 0; $i < $n; $i++) {
|
||||
$rut = $this->faker->rut(false, false);
|
||||
$abreviacion = $this->faker->streetName;
|
||||
$suffix = $this->faker->randomElement($suffixes);
|
||||
$razon = "{$suffix}{$abreviacion}";
|
||||
$sigla = strtoupper(substr($abreviacion, 0, 3));
|
||||
$data []= [
|
||||
'rut' => $rut,
|
||||
'dv' => $this->faker->digitoVerificador($rut),
|
||||
'razon' => $razon,
|
||||
'abreviacion' => $abreviacion,
|
||||
'sigla' => $sigla,
|
||||
'sociedad' => $this->faker->randomElement($tipos),
|
||||
];
|
||||
}
|
||||
$this->table('inmobiliaria')
|
||||
->insertValues($data)
|
||||
->save();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user