@@ -184,4 +184,58 @@ function test_isMail() {
184184 $ this ->mailer ->isMail ();
185185 $ this ->assertTrue ($ this ->mailer ->Mailer === 'sparkpost ' );
186186 }
187+
188+ function test_get_request_body_without_template () {
189+ $ this ->mailer ->addAddress ('abc@xyz.com ' , 'abc ' );
190+ $ this ->mailer ->addBcc ('bcc@xyz.com ' , 'bcc ' );
191+ $ this ->mailer ->addCc ('cc@xyz.com ' , 'cc ' );
192+ $ this ->mailer ->setFrom ( 'me@hello.com ' , 'me ' );
193+
194+ NSA ::setProperty ($ this ->mailer , 'settings ' , [
195+ 'enable_tracking ' => true ,
196+ 'transactional ' => false
197+ ]);
198+
199+ $ header_to = 'abc <abc@xyz.com> ' ;
200+ $ expected_request_body = [
201+ 'recipients ' => [
202+ [
203+ 'address ' => [
204+ 'email ' => 'abc@xyz.com ' ,
205+ 'header_to ' => $ header_to
206+ ]
207+ ],
208+ [
209+ 'address ' => [
210+ 'email ' => 'bcc@xyz.com ' ,
211+ 'header_to ' => $ header_to
212+ ]
213+ ],
214+ [
215+ 'address ' => [
216+ 'email ' => 'cc@xyz.com ' ,
217+ 'header_to ' => $ header_to
218+ ]
219+ ]
220+ ],
221+ 'options ' => [
222+ 'open_tracking ' => (bool ) true ,
223+ 'click_tracking ' => (bool ) true ,
224+ 'transactional ' => (bool ) false
225+ ],
226+ 'content ' => [
227+ 'from ' => [
228+ 'name ' => 'me ' ,
229+ 'email ' =>'me@hello.com '
230+ ],
231+ 'subject ' => '' ,
232+ 'headers ' => [],
233+ 'text ' => ''
234+ ]
235+ ];
236+
237+ $ actual = NSA ::invokeMethod ($ this ->mailer , 'get_request_body ' );
238+ $ actual ['content ' ]['headers ' ] = []; // for simpler $expected_request_body. alternatively stub get_headers
239+ $ this ->assertTrue ($ expected_request_body == $ actual );
240+ }
187241}
0 commit comments