Do you have authorization in your controller?
https://github.com/laracasts/birdboard/blob/master/app/Http/Controllers/ProjectsController.php#L31
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am working through Build A Laravel App with TDD and I've been stuck on this particular test.
In the file ManageProjectsTest, there is a test called Authenticated user cannot view projects of others.
This is the code I have:
$this->signIn();
$project = factory('App\Project')->create();
$this->get($project->path())->assertStatus(403);
It's the same as the code from the file they provide. However, I keep getting:
Expected status code 403 but received 200. Failed asserting that false is true.
I think the error must be somewhere else, but no luck finding it. Any ideas?
Thanks, everyone! I had missed adding $this->signIn() to that particular test. After that, it worked.
Please or to participate in this conversation.