16
16
use Twilio \Rest \Api \V2010 \Account \MessageInstance ;
17
17
use Twilio \Rest \Api \V2010 \Account \MessageList ;
18
18
use Twilio \Rest \Client as TwilioService ;
19
+ use Twilio \TwiML \VoiceResponse ;
19
20
20
21
class IntegrationTest extends MockeryTestCase
21
22
{
@@ -106,7 +107,7 @@ public function it_can_send_a_sms_message_using_alphanumeric_sender()
106
107
/** @test */
107
108
public function it_can_make_a_call ()
108
109
{
109
- $ message = TwilioCallMessage::create ('http://example.com ' );
110
+ $ message = TwilioCallMessage::create ()-> url ( 'http://example.com ' );
110
111
$ this ->notification ->shouldReceive ('toTwilio ' )->andReturn ($ message );
111
112
112
113
$ config = new TwilioConfig ([
@@ -122,6 +123,27 @@ public function it_can_make_a_call()
122
123
$ channel ->send (new NotifiableWithAttribute (), $ this ->notification );
123
124
}
124
125
126
+ /** @test */
127
+ public function it_can_make_a_twiml_call ()
128
+ {
129
+ $ voice_message = new VoiceResponse ();
130
+ $ voice_message ->say ('Message text ' );
131
+ $ message = TwilioCallMessage::create ()->twiml ($ voice_message );
132
+ $ this ->notification ->shouldReceive ('toTwilio ' )->andReturn ($ message );
133
+
134
+ $ config = new TwilioConfig ([
135
+ 'from ' => '+31612345678 ' ,
136
+ ]);
137
+ $ twilio = new Twilio ($ this ->twilioService , $ config );
138
+ $ channel = new TwilioChannel ($ twilio , $ this ->events );
139
+
140
+ $ this ->callWillBeSentToTwilioWith ('+22222222222 ' , '+31612345678 ' , [
141
+ 'twiml ' => trim ($ message ->content ),
142
+ ]);
143
+
144
+ $ channel ->send (new NotifiableWithAttribute (), $ this ->notification );
145
+ }
146
+
125
147
protected function smsMessageWillBeSentToTwilioWith (...$ args )
126
148
{
127
149
$ this ->twilioService ->messages ->shouldReceive ('create ' )
0 commit comments