2020use Symfony \Component \Serializer \Normalizer \MimeMessageNormalizer ;
2121use Symfony \Component \Serializer \Normalizer \ObjectNormalizer ;
2222use Symfony \Component \Serializer \Normalizer \PropertyNormalizer ;
23- use Symfony \Component \Serializer \Normalizer \TranslatableNormalizer ;
2423use Symfony \Component \Serializer \Serializer ;
25- use Symfony \Component \Translation \IdentityTranslator ;
26- use Symfony \Component \Translation \TranslatableMessage ;
2724
2825class TemplatedEmailTest extends TestCase
2926{
@@ -47,22 +44,19 @@ public function testSerialize()
4744 ->htmlTemplate ('text.html.twig ' )
4845 ->context ($ context = ['a ' => 'b ' ])
4946 ->locale ($ locale = 'fr_FR ' )
50- ->subject ($ subject = new TranslatableMessage ('hello {{ name }} ' , ['name ' => 'John ' ], 'greetings ' ))
5147 ;
5248
5349 $ email = unserialize (serialize ($ email ));
5450 $ this ->assertEquals ('text.txt.twig ' , $ email ->getTextTemplate ());
5551 $ this ->assertEquals ('text.html.twig ' , $ email ->getHtmlTemplate ());
5652 $ this ->assertEquals ($ context , $ email ->getContext ());
5753 $ this ->assertEquals ($ locale , $ email ->getLocale ());
58- $ this ->assertEquals ($ subject , $ email ->getTranslatableSubject ());
5954 }
6055
6156 public function testSymfonySerialize ()
6257 {
6358 // we don't add from/sender to check that validation is not triggered to serialize an email
6459 $ e = new TemplatedEmail ();
65- $ e ->subject (new TranslatableMessage ('hello.world ' ));
66606761 $ e ->textTemplate ('email.txt.twig ' );
6862 $ e ->htmlTemplate ('email.html.twig ' );
@@ -73,7 +67,6 @@ public function testSymfonySerialize()
7367
7468 $ expectedJson = <<<EOF
7569{
76- "subject": "hello.world",
7770 "htmlTemplate": "email.html.twig",
7871 "textTemplate": "email.txt.twig",
7972 "locale": "en",
@@ -91,15 +84,6 @@ public function testSymfonySerialize()
9184 }
9285 ],
9386 "headers": {
94- "subject": [
95- {
96- "value": "hello.world",
97- "name": "Subject",
98- "lineLength": 76,
99- "lang": null,
100- "charset": "utf-8"
101- }
102- ],
10387 "to": [
10488 {
10589 "addresses": [
@@ -124,7 +108,6 @@ public function testSymfonySerialize()
124108 $ serializer = new Serializer ([
125109 new ArrayDenormalizer (),
126110 new MimeMessageNormalizer ($ propertyNormalizer ),
127- new TranslatableNormalizer (new IdentityTranslator ()),
128111 new ObjectNormalizer (null , null , null , $ extractor ),
129112 $ propertyNormalizer ,
130113 ], [new JsonEncoder ()]);
0 commit comments