Level 39
You haven't imported the Project model at the top of the file, thus it's trying to look for it in the tests folder instead.
1 like
Hi all,
I am trying to get this test running but phpunit is giving me a error message which leaves me more clueless than before...
Tests\Feature\ManageProjectsTest::a_user_can_create_a_project
Error: Class 'Tests\Feature\Project' not found
the test:
public function a_user_can_create_a_project()
{
$this->withoutExceptionHandling();
$this->signIn();
$this->get('/projects/create')->assertStatus(200);
$attributes = [
'title' => $this->faker->sentence,
'description' => $this->faker->paragraph
];
$response = $this->post('/projects', $attributes);
$response->assertRedirect(Project::where($attributes)->first()->path());
$this->assertDatabaseHas('projects', $attributes);
$this->get('/projects')->assertSee($attributes['title']);
I am certain that this line is the issue. However I cant explain the reason or any fix for it
$response->assertRedirect(Project::where($attributes)->first()->path());
Thanks in advance !
You haven't imported the Project model at the top of the file, thus it's trying to look for it in the tests folder instead.
Please or to participate in this conversation.