请帮助我编写单元测试存根,以了解是否发送了松弛通知。在执行一批操作时,如果发生错误,我将在松弛通道中发送错误。
答案 0 :(得分:0)
在测试中,您应该使用MockApplicationServices特性。它的工作原理几乎与 the documented event mocking.
用法是:
$this->expectsNotification($notifiable, $notification);
// eg.
$this->expectsNotification($user, UpperLimitExceeded::class);
还有$ this-> withoutNotifications()跳过任何遇到的通知。