1616use Twilio \Rest \Api \V2010 \Account \MessageInstance ;
1717use Twilio \Rest \Api \V2010 \Account \MessageList ;
1818use Twilio \Rest \Client as TwilioService ;
19+ use Twilio \TwiML \VoiceResponse ;
1920
2021class IntegrationTest extends MockeryTestCase
2122{
@@ -106,7 +107,7 @@ public function it_can_send_a_sms_message_using_alphanumeric_sender()
106107 /** @test */
107108 public function it_can_make_a_call ()
108109 {
109- $ message = TwilioCallMessage::create ('http://example.com ' );
110+ $ message = TwilioCallMessage::create ()-> url ( 'http://example.com ' );
110111 $ this ->notification ->shouldReceive ('toTwilio ' )->andReturn ($ message );
111112
112113 $ config = new TwilioConfig ([
@@ -122,6 +123,27 @@ public function it_can_make_a_call()
122123 $ channel ->send (new NotifiableWithAttribute (), $ this ->notification );
123124 }
124125
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+
125147 protected function smsMessageWillBeSentToTwilioWith (...$ args )
126148 {
127149 $ this ->twilioService ->messages ->shouldReceive ('create ' )
0 commit comments