File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change 22
33namespace NotificationChannels \Twilio ;
44
5- use Illuminate \Support \ServiceProvider ;
65use Services_Twilio as TwilioService ;
6+ use Illuminate \Support \ServiceProvider ;
77
88class TwilioProvider extends ServiceProvider
99{
@@ -18,13 +18,16 @@ public function boot()
1818 $ config = $ this ->app ['config ' ]['services.twilio ' ];
1919
2020 return new Twilio (
21- $ this ->app ->make (TwilioService::class, [
22- $ config ['account_sid ' ],
23- $ config ['auth_token ' ],
24- ]),
21+ $ this ->app ->make (TwilioService::class),
2522 $ config ['from ' ]
2623 );
2724 });
25+
26+ $ this ->app ->bind (TwilioService::class, function () {
27+ $ config = $ this ->app ['config ' ]['services.twilio ' ];
28+
29+ return new TwilioService ($ config ['account_sid ' ], $ config ['auth_token ' ]);
30+ });
2831 }
2932
3033 /**
Original file line number Diff line number Diff line change 22
33namespace NotificationChannels \Twilio \Test ;
44
5- use Illuminate \Contracts \Foundation \Application ;
65use Mockery ;
7- use NotificationChannels \Twilio \TwilioChannel ;
8- use NotificationChannels \Twilio \TwilioProvider ;
6+ use ArrayAccess ;
97use PHPUnit_Framework_TestCase ;
108use Services_Twilio as TwilioService ;
119use NotificationChannels \Twilio \Twilio ;
12- use ArrayAccess ;
10+ use NotificationChannels \Twilio \TwilioChannel ;
11+ use NotificationChannels \Twilio \TwilioProvider ;
12+ use Illuminate \Contracts \Foundation \Application ;
1313
1414class TwilioProviderTest extends PHPUnit_Framework_TestCase
1515{
@@ -49,6 +49,10 @@ public function it_gives_an_instantiated_twilio_object_when_the_channel_asks_for
4949 return $ twilio () instanceof Twilio;
5050 }))->once ();
5151
52+ $ this ->app ->shouldReceive ('bind ' )->with (TwilioService::class, Mockery::on (function ($ twilio ) {
53+ return $ twilio () instanceof TwilioService;
54+ }))->once ()->andReturn ($ this ->app );
55+
5256 $ this ->provider ->boot ();
5357 }
5458}
You can’t perform that action at this time.
0 commit comments