20
20
use Symfony \Component \Serializer \Normalizer \MimeMessageNormalizer ;
21
21
use Symfony \Component \Serializer \Normalizer \ObjectNormalizer ;
22
22
use Symfony \Component \Serializer \Normalizer \PropertyNormalizer ;
23
- use Symfony \Component \Serializer \Normalizer \TranslatableNormalizer ;
24
23
use Symfony \Component \Serializer \Serializer ;
25
- use Symfony \Component \Translation \IdentityTranslator ;
26
- use Symfony \Component \Translation \TranslatableMessage ;
27
24
28
25
class TemplatedEmailTest extends TestCase
29
26
{
@@ -47,22 +44,19 @@ public function testSerialize()
47
44
->htmlTemplate ('text.html.twig ' )
48
45
->context ($ context = ['a ' => 'b ' ])
49
46
->locale ($ locale = 'fr_FR ' )
50
- ->subject ($ subject = new TranslatableMessage ('hello {{ name }} ' , ['name ' => 'John ' ], 'greetings ' ))
51
47
;
52
48
53
49
$ email = unserialize (serialize ($ email ));
54
50
$ this ->assertEquals ('text.txt.twig ' , $ email ->getTextTemplate ());
55
51
$ this ->assertEquals ('text.html.twig ' , $ email ->getHtmlTemplate ());
56
52
$ this ->assertEquals ($ context , $ email ->getContext ());
57
53
$ this ->assertEquals ($ locale , $ email ->getLocale ());
58
- $ this ->assertEquals ($ subject , $ email ->getTranslatableSubject ());
59
54
}
60
55
61
56
public function testSymfonySerialize ()
62
57
{
63
58
// we don't add from/sender to check that validation is not triggered to serialize an email
64
59
$ e = new TemplatedEmail ();
65
- $ e ->subject (new TranslatableMessage ('hello.world ' ));
66
60
$ e ->to ('you@example.com ' );
67
61
$ e ->textTemplate ('email.txt.twig ' );
68
62
$ e ->htmlTemplate ('email.html.twig ' );
@@ -73,7 +67,6 @@ public function testSymfonySerialize()
73
67
74
68
$ expectedJson = <<<EOF
75
69
{
76
- "subject": "hello.world",
77
70
"htmlTemplate": "email.html.twig",
78
71
"textTemplate": "email.txt.twig",
79
72
"locale": "en",
@@ -91,15 +84,6 @@ public function testSymfonySerialize()
91
84
}
92
85
],
93
86
"headers": {
94
- "subject": [
95
- {
96
- "value": "hello.world",
97
- "name": "Subject",
98
- "lineLength": 76,
99
- "lang": null,
100
- "charset": "utf-8"
101
- }
102
- ],
103
87
"to": [
104
88
{
105
89
"addresses": [
@@ -124,7 +108,6 @@ public function testSymfonySerialize()
124
108
$ serializer = new Serializer ([
125
109
new ArrayDenormalizer (),
126
110
new MimeMessageNormalizer ($ propertyNormalizer ),
127
- new TranslatableNormalizer (new IdentityTranslator ()),
128
111
new ObjectNormalizer (null , null , null , $ extractor ),
129
112
$ propertyNormalizer ,
130
113
], [new JsonEncoder ()]);
0 commit comments