Skip to content

Commit 39967dd

Browse files
authored
Merge pull request #13 from ErickJMenezes/ErickJMenezes
feature: Add support to anonymous notifiables.
2 parents cb7e8d9 + 1723248 commit 39967dd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/SnsChannelTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Contracts\Events\Dispatcher;
66
use Illuminate\Notifications\Events\NotificationFailed;
77
use Illuminate\Notifications\Notification;
8+
use Illuminate\Support\Facades\Notification as NotificationFacade;
89
use Mockery;
910
use NotificationChannels\AwsSns\Sns;
1011
use NotificationChannels\AwsSns\SnsChannel;
@@ -115,6 +116,22 @@ public function it_will_dispatch_an_event_in_case_of_an_invalid_message()
115116

116117
$this->channel->send($notifiable, $notification);
117118
}
119+
120+
/** @test */
121+
public function it_will_send_a_sms_to_an_anonymous_notifiable()
122+
{
123+
$notification = Mockery::mock(Notification::class);
124+
$notification->shouldReceive('toSns')->andReturn('Message text');
125+
126+
$phoneNumber = '+22222222222';
127+
$anonymousNotifiable = NotificationFacade::route('sns', $phoneNumber);
128+
129+
$this->sns->shouldReceive('send')
130+
->atLeast()->once()
131+
->with(Mockery::type(SnsMessage::class), $phoneNumber);
132+
133+
$this->channel->send($anonymousNotifiable, $notification);
134+
}
118135
}
119136

120137
class Notifiable

0 commit comments

Comments
 (0)