Php 如何在测试中启用异常处理?
我想通过Php 如何在测试中启用异常处理?,php,laravel,laravel-7,Php,Laravel,Laravel 7,我想通过App\Exceptions\Handler处理测试中的异常 我调用$this->withExceptionHandling()在handle()测试方法中,但无效 我该怎么做 Laravel框架7.30.4 您想“启用句柄异常”是什么意思?@matiaslauriti当异常在其他地方而不是在测试中抛出时,将调用App\Exceptions\Handler。在测试中引发异常时,不会调用App\Exceptions\Handler。您想使用withoutExceptionHandling(
App\Exceptions\Handler
处理测试中的异常
我调用$this->withExceptionHandling()代码>在handle()
测试方法中,但无效
我该怎么做
Laravel框架7.30.4
您想“启用句柄异常”是什么意思?@matiaslauriti当异常在其他地方而不是在测试中抛出时,将调用App\Exceptions\Handler。在测试中引发异常时,不会调用App\Exceptions\Handler。您想使用withoutExceptionHandling()
,这将引发异常,以便您能够使用App\Exceptions\Handler
,但为什么要这样做?请你再解释一下好吗?当我尝试调用withoutExceptionHandling()
withoutExceptionHandling()时,如果您试图使用withoutExceptionHandling()
@matiaslauriti测试某个东西,则会出现一些奇怪的情况,不会发生任何事情<未调用代码>应用程序\异常\处理程序
。我正在使用dusk,希望通过电子邮件发送异常。