Level 13
This is something you probably don't need to test. firstOrFail is part of laravel and therefore it's up to laravel to ensure that it works.
I have a method on my controller:
public function show($slug)
{
$category = Category::whereSlug($slug)->firstOrFail();
}
I want to write a simple test:
public function testCagegoryDoesNotExist()
{
$this->visit('category/lorem')->assertResponseStatus(500);
}
But now I'm getting only exception and test fails. Should I mock Category model or there is another easy way to test that.
Please or to participate in this conversation.