File tree 1 file changed +19
-0
lines changed 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \Notifier \Bridge \Sweego \Tests ;
13
13
14
14
use Symfony \Component \HttpClient \MockHttpClient ;
15
+ use Symfony \Component \HttpClient \Response \JsonMockResponse ;
15
16
use Symfony \Component \Notifier \Bridge \Sweego \SweegoTransport ;
16
17
use Symfony \Component \Notifier \Exception \UnsupportedMessageTypeException ;
17
18
use Symfony \Component \Notifier \Message \ChatMessage ;
@@ -68,4 +69,22 @@ public function testSendWithInvalidMessageType()
68
69
$ message = $ this ->createMock (MessageInterface::class);
69
70
$ transport ->send ($ message );
70
71
}
72
+
73
+ public function testSendSmsMessage ()
74
+ {
75
+ $ client = new MockHttpClient (function ($ method , $ url , $ options ) {
76
+ $ this ->assertSame ('POST ' , $ method );
77
+ $ this ->assertSame ('https://api.sweego.io/send ' , $ url );
78
+
79
+ $ body = json_decode ($ options ['body ' ], true );
80
+ $ this ->assertSame ('sms ' , $ body ['channel ' ]);
81
+
82
+ return new JsonMockResponse (['swg_uids ' => ['123 ' ]]);
83
+ });
84
+
85
+ $ transport = self ::createTransport ($ client );
86
+ $ sentMessage = $ transport ->send (new SmsMessage ('0611223344 ' , 'Hello! ' ));
87
+
88
+ $ this ->assertSame ('123 ' , $ sentMessage ->getMessageId ());
89
+ }
71
90
}
You can’t perform that action at this time.
0 commit comments