Skip to content

Commit a731d4c

Browse files
committed
Added extra twilio tests
1 parent dc088cf commit a731d4c

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/TwilioTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,54 @@ public function it_can_send_a_sms_message_to_twilio()
6767
$this->twilio->sendMessage($message, '+1111111111');
6868
}
6969

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+
70118
/** @test */
71119
public function it_can_send_a_call_to_twilio()
72120
{

0 commit comments

Comments
 (0)