Hello,
As the title suggests, I'm trying to cover with tests some controller actions that require password confirmation before continuing with the intended "action" of the authenticated user.
Google search get's confused with my query and returns only how to implement password confirmation or password validation. This is done and works just fine.
// In web.php routes
Route::post('deactivate-account', controller-stuff)->middleware(['password.confirm'])->name('deactivation-route');
// in a test class
...
$this
->actingAs($user)
->from('/anywhere')
->post(route('deactivation-route'))
->assertRedirect(route('password.confirm')); // This is ok, works
...
That's for a test case for example: "user_gets_password_confirmation_prompt_when_deactivating_account()"
But can't figure out how to test the entire flow without ending up "disabling" middleware handling with some dark magic code. It doesn't feel right.
Is there any way to make the test pass the entire flow, and have everything working without disabling anything?? I hope I missed something and it is "as simple as that" :)
Thanks in advance!