Hi,
Very new here, and working through an online tutorial - but I'm stuck. Hopeful the community can point me in the right direction.
I have this Unit Test:
public function test_StoreValid()
{
$params = [
'title' => 'Valid Title',
'content' => 'At least 10 characters'
];
$this->post('/posts', $params)
->assertStatus(302)
->assertSessionHas('status');
$this->assertEquals(session('status'), 'The blog post was created!');
I have this Route:
route::resource('posts', PostsController::class);
The Unit Test is successfully creating the post and everything is working as intended - but I don't know why it's working. $this->post('/posts', $params) The /posts route takes you to a view that only displays posts - no ability to create a post there. To create one you'd need to navigate to /posts/create. I'm totally lost as to how the above Unit Test is able to create the test post since it's not being pointed to /posts/create.