22
33namespace NotificationChannels \Messagebird \Test ;
44
5+ use GuzzleHttp \Client ;
56use Illuminate \Notifications \Notifiable ;
67use Illuminate \Notifications \Notification ;
7- use MessageBird \Client ;
88use Mockery ;
99use NotificationChannels \Messagebird \MessagebirdChannel ;
1010use NotificationChannels \Messagebird \MessagebirdClient ;
@@ -17,8 +17,8 @@ public function setUp()
1717 {
1818 $ this ->notification = new TestNotification ;
1919 $ this ->notifiable = new TestNotifiable ;
20- $ this ->messagebirdClient = Mockery::mock (new Client (' test_1234567890 ' ));
21- $ this ->client = Mockery::mock (new MessagebirdClient ($ this ->messagebirdClient ));
20+ $ this ->guzzle = Mockery::mock (new Client ());
21+ $ this ->client = Mockery::mock (new MessagebirdClient ($ this ->guzzle , ' test_ek1qBbKbHoA20gZHM40RBjxzX ' ));
2222 $ this ->channel = new MessagebirdChannel ($ this ->client );
2323 }
2424
@@ -34,6 +34,13 @@ public function it_can_be_instantiated()
3434 $ this ->assertInstanceOf (MessagebirdClient::class, $ this ->client );
3535 $ this ->assertInstanceOf (MessagebirdChannel::class, $ this ->channel );
3636 }
37+
38+ /** @test */
39+ public function test_it_shares_message ()
40+ {
41+ $ this ->client ->shouldReceive ('send ' )->once ();
42+ $ this ->channel ->send ($ this ->notifiable , $ this ->notification );
43+ }
3744}
3845
3946class TestNotifiable
@@ -42,14 +49,14 @@ class TestNotifiable
4249
4350 public function routeNotificationForMessagebird ()
4451 {
45- return '0031650520659 ' ;
52+ return '31650520659 ' ;
4653 }
4754}
4855
4956class TestNotification extends Notification
5057{
5158 public function toMessagebird ($ notifiable )
5259 {
53- return (new MessagebirdMessage ('Message content ' ))->setOriginator ('APPNAME ' )->setRecipients ('0031650520659 ' );
60+ return (new MessagebirdMessage ('Message content ' ))->setOriginator ('APPNAME ' )->setRecipients ('31650520659 ' );
5461 }
5562}
0 commit comments