samedi 10 août 2019

laravel show unit test is not asserting

i have a laravel application that i want to write tests for now when i run show test its not working and i am writing this test for my api btw : so my test is like below :

public function testShow()
{
    $response = $this->json('GET', '/api/roomfacility/{roomfacility}', []);

    $response->assertStatus(200);

}

but i get this error :

    20) Tests\Feature\RoomCapacityHistoryTest::testShow
Expected status code 200 but received 404.
Failed asserting that false is true.

i want to know what is the error here because when i try it in browser it works and i want to know how to test my crud api , i want to test my index,show,create,update for my api i know there are some tutorials about the testing but they are not about the api .

Aucun commentaire:

Enregistrer un commentaire