I'm working on a legacy code and trying to use tests to cover the code for later refactoring. In one controller there's a piece of code like this:
return redirect()->route('login')->withErrors(['invalid credentials']);
Here are my assertions for the test:
$response->assertRedirect(route('login'));
$response->assertSessionHasErrors([
0 => 'invalid credentials'
]);
But the problem is I get the following output:
Session missing error: 'invalid credentials'
Failed asserting that false is true.
Any idea how can I get this done?
Aucun commentaire:
Enregistrer un commentaire