@@ -24,12 +24,16 @@ class CssInlinerPluginTest extends TestCase
24
24
'converted-html ' ,
25
25
'converted-html-with-css ' ,
26
26
'converted-html-with-link-css ' ,
27
+ 'converted-html-with-link-external ' ,
28
+ 'converted-html-with-link-relative-external ' ,
27
29
'converted-html-with-links-css ' ,
28
30
'converted-html-with-mixed-type-links ' ,
29
31
'converted-html-with-non-stylesheet-link ' ,
30
32
'original-html ' ,
31
33
'original-html-with-css ' ,
32
34
'original-html-with-link-css ' ,
35
+ 'original-html-with-link-external ' ,
36
+ 'original-html-with-link-relative-external ' ,
33
37
'original-html-with-links-css ' ,
34
38
'original-html-with-mixed-type-links ' ,
35
39
'original-html-with-non-stylesheet-link ' ,
@@ -238,6 +242,50 @@ public function itShouldWorkWithMixedTypeLinks()
238
242
);
239
243
}
240
244
245
+ /** @test **/
246
+ public function itShouldWorkWithExternalLink ()
247
+ {
248
+ $ mailer = new Swift_Mailer (new Swift_NullTransport ());
249
+
250
+ $ mailer ->registerPlugin (new CssInlinerPlugin ($ this ->options ));
251
+
252
+ $ message = new Swift_Message ('Test ' );
253
+
254
+ $ message->
setFrom (
'[email protected] ' );
255
+ $ message->
setTo (
'[email protected] ' );
256
+
257
+ $ message ->setBody ($ this ->stubs ['original-html-with-link-external ' ], 'text/html ' );
258
+
259
+ $ mailer ->send ($ message );
260
+
261
+ $ this ->assertEquals (
262
+ $ this ->stubs ['converted-html-with-link-external ' ],
263
+ $ this ->normalize ($ message ->getBody ())
264
+ );
265
+ }
266
+
267
+ /** @test **/
268
+ public function itShouldWorkWithRelativeExternalLink ()
269
+ {
270
+ $ mailer = new Swift_Mailer (new Swift_NullTransport ());
271
+
272
+ $ mailer ->registerPlugin (new CssInlinerPlugin ($ this ->options ));
273
+
274
+ $ message = new Swift_Message ('Test ' );
275
+
276
+ $ message->
setFrom (
'[email protected] ' );
277
+ $ message->
setTo (
'[email protected] ' );
278
+
279
+ $ message ->setBody ($ this ->stubs ['original-html-with-link-relative-external ' ], 'text/html ' );
280
+
281
+ $ mailer ->send ($ message );
282
+
283
+ $ this ->assertEquals (
284
+ $ this ->stubs ['converted-html-with-link-relative-external ' ],
285
+ $ this ->normalize ($ message ->getBody ())
286
+ );
287
+ }
288
+
241
289
protected function normalize (string $ html ): string
242
290
{
243
291
$ document = new \DomDocument ();
0 commit comments