Am doing a unit test of an api endpoint, i have something like this:
public function testPostService()
{
$response = $this->json('POST', '/api/v1/service',[
"id"=> "someId",
"number" => 123
]);
$response
->assertStatus(201)
->assertJson([
'created' => true,
]);
}
id is a unique value, wich leads me to the problem each time i run the tests i have to either empty the database or change the id value.
Is there any way that the persisted values are only kept during the duration of the test?
My phpunit.xml is the standar
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire