【发布时间】:2018-07-21 22:08:08
【问题描述】:
当我在 laravel 5.5 中使用 assertJsonValidationErrors() 测试方法时,出现以下错误:
Call to undefined method Illuminate\Http\JsonResponse::assertJsonValidationErrors()
我不知道出了什么问题。其他测试方法对我来说效果很好。 这是我的测试方法:
public function test_user_login_when_phone_is_empty()
{
$response = $this->json(
'POST',
route('login'),
[
'phone' => '',
'password' => 'sdfksfhas4u'
]
);
$response
->assertJsonValidationErrors(['phone'])
;
}
有什么帮助吗?
【问题讨论】:
-
你能发布你的错误堆栈跟踪并给我们链接吗?
-
如果您的意思是日志文件中的堆栈跟踪,我的日志文件中没有与此错误相关的内容@NikolaGavric
-
刚刚在新的 laravel 5.5 应用程序上尝试了该方法,这就是我得到的 imgur.com/a/UAaQz
-
根据 laravel 的文档,一切都应该没问题,但事实并非如此!我很困惑。有什么建议吗? @NikolaGavric
-
我真的不知道,我什至在
Laravel文件中都找不到那个函数..
标签: php unit-testing laravel-5 phpunit