lundi 17 décembre 2018

How can I write a unit test in laravel to asserting 404 response

I'm studying a Laravel Test Driven Development Course and the version I use is 5.7

The problem is that I wrote the code below to check that if the concert is unpublished yet, then the user wouldn't be able to see it, which mean the I expected 404 response and here is my code

$concert = factory(Concert::class)->create([
    'published_at' => null
]);

$this->get('/concerts/'.$concert->id)
    ->assertStatus(404);

and each time I run this test I got this response response image

So I will appreciate it too much if anyone can tell me what I have to do to make that test work. Thnks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire