【发布时间】:2021-11-23 11:36:02
【问题描述】:
使用 Laravel 8,我正在运行一些单元测试,但在我的一个测试中出现此错误:
Call to undefined method Tests\Unit\ApplicationTest::assertSessionHasErrors()
use Tests\TestCase;
class ApplicationTest extends TestCase {
...
$applicationRef = Application::inRandomOrder()->pluck('reference')->first();
$this->post(
'http://website.test/applications/'.$applicationRef.'/update',
['title' => null]
);
$this->assertSessionHasErrors('title');
}
我已经尝试了各种方法来测试表单验证,但都无法正常工作。任何意见,将不胜感激。谢谢
【问题讨论】:
标签: laravel unit-testing phpunit