我有类似的issue for this issue post。
我的控制器正在使用此代码触发错误。
return redirect()->back()->withErrors(['This is a custom message']);//error message
我的单元测试如下。
$response = $this->from('/projects/project-1')->post('/slides/submit-new', [
'project_id' => 1,
'title' => 'This is title',
'submit' => 'Submit',
]);
$response->assertSessionHasErrors([], null, 'This is a custom message');
Laravel 5.8中的单元测试失败,并出现跟随错误。
Session is missing expected key [error].
Failed asserting that false is true.