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 2
2
3
3
namespace NotificationChannels \Twilio ;
4
4
5
- use Illuminate \Support \ServiceProvider ;
6
5
use Services_Twilio as TwilioService ;
6
+ use Illuminate \Support \ServiceProvider ;
7
7
8
8
class TwilioProvider extends ServiceProvider
9
9
{
@@ -18,13 +18,16 @@ public function boot()
18
18
$ config = $ this ->app ['config ' ]['services.twilio ' ];
19
19
20
20
return new Twilio (
21
- $ this ->app ->make (TwilioService::class, [
22
- $ config ['account_sid ' ],
23
- $ config ['auth_token ' ],
24
- ]),
21
+ $ this ->app ->make (TwilioService::class),
25
22
$ config ['from ' ]
26
23
);
27
24
});
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
+ });
28
31
}
29
32
30
33
/**
Original file line number Diff line number Diff line change 2
2
3
3
namespace NotificationChannels \Twilio \Test ;
4
4
5
- use Illuminate \Contracts \Foundation \Application ;
6
5
use Mockery ;
7
- use NotificationChannels \Twilio \TwilioChannel ;
8
- use NotificationChannels \Twilio \TwilioProvider ;
6
+ use ArrayAccess ;
9
7
use PHPUnit_Framework_TestCase ;
10
8
use Services_Twilio as TwilioService ;
11
9
use NotificationChannels \Twilio \Twilio ;
12
- use ArrayAccess ;
10
+ use NotificationChannels \Twilio \TwilioChannel ;
11
+ use NotificationChannels \Twilio \TwilioProvider ;
12
+ use Illuminate \Contracts \Foundation \Application ;
13
13
14
14
class TwilioProviderTest extends PHPUnit_Framework_TestCase
15
15
{
@@ -49,6 +49,10 @@ public function it_gives_an_instantiated_twilio_object_when_the_channel_asks_for
49
49
return $ twilio () instanceof Twilio;
50
50
}))->once ();
51
51
52
+ $ this ->app ->shouldReceive ('bind ' )->with (TwilioService::class, Mockery::on (function ($ twilio ) {
53
+ return $ twilio () instanceof TwilioService;
54
+ }))->once ()->andReturn ($ this ->app );
55
+
52
56
$ this ->provider ->boot ();
53
57
}
54
58
}
You can’t perform that action at this time.
0 commit comments