@@ -67,6 +67,54 @@ public function it_can_send_a_sms_message_to_twilio()
67
67
$ this ->twilio ->sendMessage ($ message , '+1111111111 ' );
68
68
}
69
69
70
+ /** @test */
71
+ public function it_can_send_a_sms_message_to_twilio_with_alphanumeric_sender ()
72
+ {
73
+ $ message = new TwilioSmsMessage ('Message text ' );
74
+
75
+ $ this ->config ->shouldReceive ('getAlphanumericSender ' )
76
+ ->once ()
77
+ ->andReturn ('TwilioTest ' );
78
+
79
+ $ this ->config ->shouldNotReceive ('getFrom ' );
80
+
81
+ $ this ->config ->shouldReceive ('getSmsParams ' )
82
+ ->once ()
83
+ ->andReturn ([]);
84
+
85
+ $ this ->twilioService ->account ->messages ->shouldReceive ('sendMessage ' )
86
+ ->atLeast ()->once ()
87
+ ->with ('TwilioTest ' , '+1111111111 ' , 'Message text ' , null , [])
88
+ ->andReturn (true );
89
+
90
+ $ this ->twilio ->sendMessage ($ message , '+1111111111 ' , true );
91
+ }
92
+
93
+ /** @test */
94
+ public function it_can_send_a_sms_message_to_twilio_with_messaging_service ()
95
+ {
96
+ $ message = new TwilioSmsMessage ('Message text ' );
97
+
98
+ $ this ->config ->shouldReceive ('getFrom ' )
99
+ ->once ()
100
+ ->andReturn ('+1234567890 ' );
101
+
102
+ $ this ->config ->shouldReceive ('getSmsParams ' )
103
+ ->once ()
104
+ ->andReturn ([
105
+ 'MessagingServiceSid ' => 'service_sid '
106
+ ]);
107
+
108
+ $ this ->twilioService ->account ->messages ->shouldReceive ('sendMessage ' )
109
+ ->atLeast ()->once ()
110
+ ->with ('+1234567890 ' , '+1111111111 ' , 'Message text ' , null , [
111
+ 'MessagingServiceSid ' => 'service_sid '
112
+ ])
113
+ ->andReturn (true );
114
+
115
+ $ this ->twilio ->sendMessage ($ message , '+1111111111 ' );
116
+ }
117
+
70
118
/** @test */
71
119
public function it_can_send_a_call_to_twilio ()
72
120
{
0 commit comments