【发布时间】:2020-05-11 22:18:38
【问题描述】:
我正在使用 Lumen 6.0 构建项目,现在我必须编写一些测试。我试图确保调用端点时存在验证错误,但是名为 assertSessionHasErrors 的方法不存在。
public function an_http_call_must_be_valid()
{
$response = $this->json('POST', $this->endpoint, [
'referrer' => 'web'
], $this->validHeaders);
$response->assertSessionHasErrors();
}
命令输出:
./vendor/bin/phpunit
1) EmailNotificationTest::an_http_call_must_be_valid
Error: Call to undefined method EmailNotificationTest::assertSessionHasErrors()
有什么想法吗?
【问题讨论】:
标签: laravel unit-testing phpunit lumen