@@ -257,7 +257,6 @@ public function testCreateAccountWithNewsLetterSubscription() :void
257
257
$ extensionAttributes ->setIsSubscribed (true );
258
258
$ customerDataObject ->setExtensionAttributes ($ extensionAttributes );
259
259
$ this ->accountManagement ->createAccount ($ customerDataObject , '123123qW ' );
260
-
261
260
$ message = $ this ->transportBuilderMock ->getSentMessage ();
262
261
263
262
$ this ->assertEquals ('Welcome to Main Website Store ' , $ message ->getSubject ());
@@ -275,30 +274,25 @@ public function testCreateAccountWithNewsLetterSubscription() :void
275
274
$ subscriber ->loadByEmail ('customer@example.com ' );
276
275
$ this ->assertTrue ($ subscriber ->isSubscribed ());
277
276
278
- /** @var \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder */
279
- $ transportBuilder = $ objectManager ->get (\Magento \Framework \Mail \Template \TransportBuilder::class);
280
- $ transport = $ transportBuilder ->setTemplateIdentifier ('newsletter_subscription_confirm_email_template ' )
281
- ->setTemplateOptions (
282
- [
283
- 'area ' => \Magento \Framework \App \Area::AREA_FRONTEND ,
284
- 'store ' => \Magento \Store \Model \Store::DEFAULT_STORE_ID
285
- ]
286
- )
287
- ->setTemplateVars (
288
- [
289
- 'subscriber_data ' => [
290
- 'confirmation_link ' => $ subscriber ->getConfirmationLink (),
291
- ],
292
- ]
293
- )
294
- ->addTo ('customer@example.com ' )
295
- ->getTransport ();
296
- $ sendMessage = $ transport ->getMessage ();
277
+ $ transport = $ this ->transportBuilderMock ->setTemplateIdentifier (
278
+ 'newsletter_subscription_confirm_email_template '
279
+ )->setTemplateVars ([
280
+ 'subscriber_data ' => [
281
+ 'confirmation_link ' => $ subscriber ->getConfirmationLink (),
282
+ ],
283
+ ])->setTemplateOptions ([
284
+ 'area ' => \Magento \Framework \App \Area::AREA_FRONTEND ,
285
+ 'store ' => \Magento \Store \Model \Store::DEFAULT_STORE_ID
286
+ ])
287
+ ->addTo ('customer@example.com ' )
288
+ ->getTransport ();
289
+
290
+ $ message = $ transport ->getMessage ();
297
291
298
292
$ this ->assertStringContainsString (
299
293
$ subscriber ->getConfirmationLink (),
300
- $ sendMessage ->getBody ()->getParts ()[0 ]->getRawContent ()
294
+ $ message ->getBody ()->getParts ()[0 ]->getRawContent ()
301
295
);
302
- $ this ->assertEquals ('Newsletter subscription confirmation ' , $ sendMessage ->getSubject ());
296
+ $ this ->assertEquals ('Newsletter subscription confirmation ' , $ message ->getSubject ());
303
297
}
304
298
}
0 commit comments