[TwigBridge] fix fallback html-to-txt body converter
This commit is contained in:
parent
5fe0f9490e
commit
6f59d60508
|
@ -74,6 +74,6 @@ final class BodyRenderer implements BodyRendererInterface
|
|||
return $this->converter->convert($html);
|
||||
}
|
||||
|
||||
return strip_tags($html);
|
||||
return strip_tags(preg_replace('{<(head|style)\b.*?</\1>}i', '', $html));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,11 +29,12 @@ class BodyRendererTest extends TestCase
|
|||
|
||||
public function testRenderHtmlOnly(): void
|
||||
{
|
||||
$email = $this->prepareEmail(null, '<b>HTML</b>');
|
||||
$html = '<head>head</head><b>HTML</b><style type="text/css">css</style>';
|
||||
$email = $this->prepareEmail(null, $html);
|
||||
$body = $email->getBody();
|
||||
$this->assertInstanceOf(AlternativePart::class, $body);
|
||||
$this->assertEquals('HTML', $body->getParts()[0]->bodyToString());
|
||||
$this->assertEquals('<b>HTML</b>', $body->getParts()[1]->bodyToString());
|
||||
$this->assertEquals(str_replace('=', '=3D', $html), $body->getParts()[1]->bodyToString());
|
||||
}
|
||||
|
||||
public function testRenderHtmlOnlyWithTextSet(): void
|
||||
|
|
Reference in New Issue