@@ -318,6 +318,30 @@ public function testCanSendWhatsAppText(): void
318318 $ this ->assertArrayHasKey ('message_uuid ' , $ result );
319319 }
320320
321+ public function testCanSendWhatsAppTextWithoutContext (): void
322+ {
323+ $ payload = [
324+ 'to ' => '447700900000 ' ,
325+ 'from ' => '16105551212 ' ,
326+ 'text ' => 'This is a WhatsApp text '
327+ ];
328+
329+ $ message = new WhatsAppText ($ payload ['to ' ], $ payload ['from ' ], $ payload ['text ' ]);
330+
331+ $ this ->vonageClient ->send (Argument::that (function (Request $ request ) use ($ payload ) {
332+ $ this ->assertRequestJsonBodyContains ('to ' , $ payload ['to ' ], $ request );
333+ $ this ->assertRequestJsonBodyContains ('from ' , $ payload ['from ' ], $ request );
334+ $ this ->assertRequestJsonBodyContains ('text ' , $ payload ['text ' ], $ request );
335+ $ this ->assertRequestJsonBodyContains ('channel ' , 'whatsapp ' , $ request );
336+ $ this ->assertRequestJsonBodyContains ('message_type ' , 'text ' , $ request );
337+ $ this ->assertEquals ('POST ' , $ request ->getMethod ());
338+
339+ return true ;
340+ }))->willReturn ($ this ->getResponse ('sms-success ' , 202 ));
341+ $ result = $ this ->messageClient ->send ($ message );
342+ $ this ->assertIsArray ($ result );
343+ }
344+
321345 public function testCanSendWhatsAppImage (): void
322346 {
323347 $ imageUrl = 'https://picsum.photos/200/300 ' ;
0 commit comments