-
-
Save gbelot2003/8f535fdd373a5816d5b04a7cfa51d5cb to your computer and use it in GitHub Desktop.
ExamenesPostTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Feature; | |
use Tests\TestCase; | |
use Illuminate\Foundation\Testing\WithFaker; | |
use Illuminate\Foundation\Testing\RefreshDatabase; | |
class ExamenesPostTest extends TestCase | |
{ | |
use RefreshDatabase, WithFaker; | |
private $orden; | |
public function setUp(): void | |
{ | |
parent::setUp(); | |
$this->orden = array( | |
'id' => $this->faker->randomNumber, | |
'factura_id' => 125, | |
'medico' => $this->faker->name, | |
'sucursal' => 'LRM', | |
'interno' => 12356, | |
'fecha_fac' => '2019-08-07 02:22:23', | |
'send_email' => true, | |
'paciente' => [ | |
'c_id' => $this->faker->uuid, //cliente_id | |
'name' => $this->faker->name, | |
'gender' => 'M', | |
'birth' => '1978-07-09 00:00:00', | |
'cliente_id' => 545 | |
], | |
'examenes' => array( | |
[ | |
'nombre' => 'Cardiogramas', | |
'fecha' => '2019-08-08 00:00:00', | |
'area' => 'ALG', | |
'subarea' => 'HEM', | |
'notas' => 'cualquier cosa que se necesite en esta casilla', | |
'pruebas' => | |
[ | |
[ | |
'name' => $this->faker->word, | |
'unit' => 'ulm', | |
'value' => 22.5, | |
'valref' => '25 a 45' | |
], | |
[ | |
'name' => $this->faker->word, | |
'unit' => 'ulm', | |
'value' => 22.5, | |
'valref' => '25 a 45' | |
], | |
[ | |
'name' => $this->faker->word, | |
'unit' => 'ulm', | |
'value' => 22.5, | |
'valref' => '25 a 45' | |
] | |
] | |
], | |
[ | |
'nombre' => 'Hemograma', | |
'fecha' => '2019-08-08 00:00:00', | |
'area' => 'ALG', | |
'subarea' => 'HEM', | |
'notas' => 'cualquier cosa que se necesite en esta casilla', | |
'pruebas' => | |
[ | |
[ | |
'name' => $this->faker->word, | |
'unit' => 'ulm', | |
'value' => 22.5, | |
'valref' => '25 a 45' | |
], | |
[ | |
'name' => $this->faker->word, | |
'unit' => 'ulm', | |
'value' => 22.5, | |
'valref' => '25 a 45' | |
], | |
[ | |
'name' => $this->faker->word, | |
'unit' => 'ulm', | |
'value' => 22.5, | |
'valref' => '25 a 45' | |
] | |
] | |
] | |
), | |
'validacion' => [ | |
[ | |
'name' => 'Mariana Dubon H', | |
'esp' => 'Especialista en', | |
'firma' => '' | |
], | |
[ | |
'name' => 'Ariana Dubon H', | |
'esp' => 'Especialista en', | |
'firma' => '' | |
] | |
] | |
); | |
} | |
/** @test */ | |
public function the_post_save_ordenes() | |
{ | |
$this->post('api/resultados', $this->orden) | |
->assertStatus(200); | |
$this->assertDatabaseHas('ordens', ['factura_id' => 125]); | |
} | |
/** @test */ | |
public function the_post_save_pacientes() | |
{ | |
$this->post('api/resultados', $this->orden) | |
->assertStatus(200); | |
$this->assertDatabaseHas('pacientes', ['cliente_id' => 545]); | |
} | |
/** @test */ | |
public function the_post_save_examenes() | |
{ | |
$this->post('api/resultados', $this->orden) | |
->assertStatus(200); | |
$this->assertDatabaseHas('examens', ['nombre' => 'Hemograma']); | |
$this->assertDatabaseHas('examens', ['notas' => 'cualquier cosa que se necesite en esta casilla']); | |
} | |
/** @test */ | |
public function the_post_save_pruebas() | |
{ | |
$this->post('api/resultados', $this->orden) | |
->assertStatus(200); | |
$this->assertDatabaseHas('pruebas', ['value' => 22.5]); | |
$this->assertDatabaseHas('pruebas', ['valref' => '25 a 45']); | |
} | |
/** @test */ | |
public function the_post_save_validaciones() | |
{ | |
$this->post('api/resultados', $this->orden) | |
->assertStatus(200); | |
$this->assertDatabaseHas('validacions', ['name' => 'Mariana Dubon H']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment