@@ -118,6 +118,49 @@ public function testCanRequestSMS(): void
118118 $ this ->assertArrayHasKey ('request_id ' , $ result );
119119 }
120120
121+ public function testWillPopulateEntityIdAndContentId (): void
122+ {
123+ $ payload = [
124+ 'to ' => '07785254785 ' ,
125+ 'client_ref ' => 'my-verification ' ,
126+ 'brand ' => 'my-brand ' ,
127+ 'from ' => 'vonage ' ,
128+ 'entity_id ' => '1101407360000017170 ' ,
129+ 'content_id ' => '1107158078772563946 '
130+ ];
131+
132+ $ smsVerification = new SMSRequest (
133+ $ payload ['to ' ],
134+ $ payload ['brand ' ],
135+ null ,
136+ $ payload ['from ' ],
137+ $ payload ['entity_id ' ],
138+ $ payload ['content_id ' ]
139+ );
140+
141+ $ smsVerification ->setClientRef ($ payload ['client_ref ' ]);
142+
143+ $ this ->vonageClient ->send (Argument::that (function (Request $ request ) use ($ payload ) {
144+ $ uri = $ request ->getUri ();
145+ $ uriString = $ uri ->__toString ();
146+ $ this ->assertEquals (
147+ 'https://api.nexmo.com/v2/verify ' ,
148+ $ uriString
149+ );
150+
151+ $ this ->assertRequestJsonBodyContains ('entity_id ' , '1101407360000017170 ' , $ request , true );
152+ $ this ->assertRequestJsonBodyContains ('content_id ' , '1107158078772563946 ' , $ request , true );
153+ $ this ->assertEquals ('POST ' , $ request ->getMethod ());
154+
155+ return true ;
156+ }))->willReturn ($ this ->getResponse ('verify-request-success ' , 202 ));
157+
158+ $ result = $ this ->verify2Client ->startVerification ($ smsVerification );
159+
160+ $ this ->assertIsArray ($ result );
161+ $ this ->assertArrayHasKey ('request_id ' , $ result );
162+ }
163+
121164 public function testCanBypassFraudCheck (): void
122165 {
123166 $ payload = [
@@ -434,7 +477,7 @@ public function testCannotSendConcurrentVerifications(): void
434477 ];
435478
436479 $ smsVerification = new SMSRequest ($ payload ['to ' ], $ payload ['brand ' ]);
437- $ smsVerification ->setClientRef ( $ payload ['client_ref ' ]);
480+ $ smsVerification ->setClientRef ($ payload ['client_ref ' ]);
438481
439482 $ this ->vonageClient ->send (Argument::that (function (Request $ request ) {
440483 $ this ->assertEquals ('POST ' , $ request ->getMethod ());
0 commit comments