@@ -66,7 +66,7 @@ public function testHtmlBody()
6666
6767 $ this ->mailer ->send ($ message );
6868
69- $ this ->assertEquals ($ this ->emailConverted , $ message ->getBody ());
69+ $ this ->assertStringEqualsStringWithoutIndentation ($ this ->emailConverted , $ message ->getBody ());
7070 }
7171
7272 /**
@@ -83,7 +83,7 @@ public function testHtmlPart()
8383
8484 $ children = $ message ->getChildren ();
8585
86- $ this ->assertEquals ($ this ->emailConverted , $ children [0 ]->getBody ());
86+ $ this ->assertStringEqualsStringWithoutIndentation ($ this ->emailConverted , $ children [0 ]->getBody ());
8787 }
8888
8989 /**
@@ -113,4 +113,19 @@ public function testInjectedConverterIsUsedInsteadOfDefault()
113113 $ mailer ->registerPlugin (new CssInlinerPlugin ($ converterStub ));
114114 $ mailer ->send ($ message );
115115 }
116+
117+ /**
118+ * This assert is an ugly hack aiming to fix an indent issue when using libxml < 2.9.5.
119+ *
120+ * @param string $expected
121+ * @param string $actual
122+ * @param string $message
123+ */
124+ private function assertStringEqualsStringWithoutIndentation ($ expected , $ actual , $ message = '' )
125+ {
126+ $ expected = preg_replace ('/^[[:space:]]+|\n/m ' , '' , $ expected );
127+ $ actual = preg_replace ('/^[[:space:]]+|\n/m ' , '' , $ actual );
128+
129+ $ this ->assertEquals ($ expected , $ actual , $ message );
130+ }
116131}
0 commit comments