【问题标题】:Testing that an on demand nexmo notification has been sent测试是否已发送按需 nexmo 通知
【发布时间】:2020-07-15 19:56:08
【问题描述】:

我认为我应该能够做到这一点,使用类似的东西:

Notification::assertSentTo(new AnonymousNotifiable(), Notification::class, function($notification, $channels, $notifiable){
            return $notifiable->routes['mail'] == 'mail@yahoo.com';
        });

https://github.com/laravel/framework/pull/21379

但我不确定如何将它用于 nexmo 路线,我正在尝试这样的事情:

Notification::assertSentTo(new AnonymousNotifiable(), Notification::class, function($notification, $channels, $notifiable){
            return $notifiable->routes['nexmo'] == '12345';
        });

我收到“未发送预期的 [Illuminate\Support\Facades\Notification] 通知。无法断言 false 为真。”

有什么想法吗?

【问题讨论】:

    标签: laravel


    【解决方案1】:

    像这样工作:

    Notification::assertSentTo(new AnonymousNotifiable(), SMS::class, function($notification, $channels, $notifiable) use ($toNumber){
                return $notifiable->routes['nexmo'] == $toNumber;
            });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-04
      • 2018-02-26
      • 1970-01-01
      • 1970-01-01
      • 2012-02-26
      • 2016-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多